Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\SummaryFormatter Class Reference

Formatter for Summary objects. More...

Public Member Functions

 __construct (EntityIdFormatter $idFormatter, ValueFormatter $valueFormatter, SnakFormatter $snakFormatter, Language $language, EntityIdParser $idParser)
 
 formatAutoComment (FormatableSummary $summary)
 Format the autocomment part of a full summary.
 
 formatAutoSummary (FormatableSummary $summary)
 Formats the auto summary part of a full summary.
 
 formatSummary (FormatableSummary $summary)
 Format the given summary.
 

Protected Member Functions

 formatArgList (array $args)
 
 formatArg ( $arg)
 Format an auto summary argument.
 
 formatKeyValuePairs (array $pairs)
 Turns an associative array into a list of strings by rendering each key/value pair.
 

Private Member Functions

 formatIfEntityId ( $value)
 
 assembleSummaryString ( $autoComment, $autoSummary, $userSummary)
 Merge the total summary.
 

Private Attributes

 $language
 
 $idFormatter
 
 $valueFormatter
 
 $snakFormatter
 
 $idParser
 
 $stringNormalizer
 

Detailed Description

Formatter for Summary objects.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\SummaryFormatter::__construct ( EntityIdFormatter $idFormatter,
ValueFormatter $valueFormatter,
SnakFormatter $snakFormatter,
Language $language,
EntityIdParser $idParser )
Parameters
EntityIdFormatter$idFormatterPlease note that the magic label substitution we apply on top of this only works in case this returns links without display text.
ValueFormatter$valueFormatter
SnakFormatter$snakFormatter
Language$language
EntityIdParser$idParser
Exceptions
InvalidArgumentException

Member Function Documentation

◆ assembleSummaryString()

Wikibase\Repo\SummaryFormatter::assembleSummaryString ( $autoComment,
$autoSummary,
$userSummary )
private

Merge the total summary.

Parameters
string$autoCommentautocomment part, will be placed in a block comment
string$autoSummaryhuman readable string to be appended after the autocomment part
string$userSummaryuser provided summary to be appended after the autoSummary
Returns
string to be used for the summary

◆ formatArg()

Wikibase\Repo\SummaryFormatter::formatArg ( $arg)
protected

Format an auto summary argument.

Parameters
mixed$arg
Returns
string

◆ formatArgList()

Wikibase\Repo\SummaryFormatter::formatArgList ( array $args)
protected
Parameters
array$args
Returns
string[]

◆ formatAutoComment()

Wikibase\Repo\SummaryFormatter::formatAutoComment ( FormatableSummary $summary)

Format the autocomment part of a full summary.

Note that the first argument is always the number of summary arguments supplied via addAutoSummaryArgs() (or the constructor), and the second one is always the language code supplied via setLanguage() (or the constructor).

Parameters
FormatableSummary$summary
Returns
string with a formatted comment, or possibly an empty string

◆ formatAutoSummary()

Wikibase\Repo\SummaryFormatter::formatAutoSummary ( FormatableSummary $summary)

Formats the auto summary part of a full summary.

Parameters
FormatableSummary$summary
Returns
string The auto summary arguments comma-separated

◆ formatIfEntityId()

Wikibase\Repo\SummaryFormatter::formatIfEntityId ( $value)
private

◆ formatKeyValuePairs()

Wikibase\Repo\SummaryFormatter::formatKeyValuePairs ( array $pairs)
protected

Turns an associative array into a list of strings by rendering each key/value pair.

Keys will be left as-is, values will be rendered using formatArg().

Parameters
array$pairs
Returns
string[]

◆ formatSummary()

Wikibase\Repo\SummaryFormatter::formatSummary ( FormatableSummary $summary)

Format the given summary.

Parameters
FormatableSummary$summary
Returns
string to be used for the summary

Member Data Documentation

◆ $idFormatter

Wikibase\Repo\SummaryFormatter::$idFormatter
private

◆ $idParser

Wikibase\Repo\SummaryFormatter::$idParser
private

◆ $language

Wikibase\Repo\SummaryFormatter::$language
private

◆ $snakFormatter

Wikibase\Repo\SummaryFormatter::$snakFormatter
private

◆ $stringNormalizer

Wikibase\Repo\SummaryFormatter::$stringNormalizer
private

◆ $valueFormatter

Wikibase\Repo\SummaryFormatter::$valueFormatter
private

The documentation for this class was generated from the following file: