MediaWiki  master
MediaWiki\CommentFormatter\RevisionCommentBatch Class Reference

Fluent interface for revision comment batch inputs. More...

Collaboration diagram for MediaWiki\CommentFormatter\RevisionCommentBatch:

Public Member Functions

 __construct (CommentFormatter $formatter)
 
 authority (Authority $authority)
 Set the authority to use for permission checks. More...
 
 execute ()
 Format the comments. More...
 
 hideIfDeleted ( $isPublic=true)
 If this is true, show the comment only if all users can see it. More...
 
 indexById ( $indexById=true)
 If this is true, the array keys in the return value will be the revision IDs instead of the keys from the input array. More...
 
 revisions ( $revisions)
 Set the revisions to extract comments from. More...
 
 samePage ( $samePage=true)
 Set the same-page option. More...
 
 useParentheses ( $useParentheses=true)
 Wrap the comment with parentheses. More...
 

Private Attributes

Authority null $authority
 
CommentFormatter $formatter
 
bool $indexById = false
 
bool $isPublic = false
 
iterable< RevisionRecord$revisions
 
bool $samePage = false
 
bool $useParentheses = false
 

Detailed Description

Fluent interface for revision comment batch inputs.

Since
1.38

Definition at line 13 of file RevisionCommentBatch.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\CommentFormatter\RevisionCommentBatch::__construct ( CommentFormatter  $formatter)

Member Function Documentation

◆ authority()

MediaWiki\CommentFormatter\RevisionCommentBatch::authority ( Authority  $authority)

Set the authority to use for permission checks.

This must be called prior to execute().

Parameters
Authority$authority
Returns
$this

Definition at line 43 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\$authority.

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\execute().

◆ execute()

MediaWiki\CommentFormatter\RevisionCommentBatch::execute ( )

Format the comments.

Returns
string[] Formatted comments. The array key is either the field value specified by indexField(), or if that was not called, it is the key from the array passed to revisions().

Definition at line 123 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\authority(), MediaWiki\CommentFormatter\RevisionCommentBatch\indexById(), MediaWiki\CommentFormatter\RevisionCommentBatch\revisions(), MediaWiki\CommentFormatter\RevisionCommentBatch\samePage(), and MediaWiki\CommentFormatter\RevisionCommentBatch\useParentheses().

◆ hideIfDeleted()

MediaWiki\CommentFormatter\RevisionCommentBatch::hideIfDeleted (   $isPublic = true)

If this is true, show the comment only if all users can see it.

We'll call it hideIfDeleted() since public is a keyword and isPublic() has an inappropriate verb.

Parameters
bool$isPublic
Returns
$this

Definition at line 99 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\$isPublic.

◆ indexById()

MediaWiki\CommentFormatter\RevisionCommentBatch::indexById (   $indexById = true)

If this is true, the array keys in the return value will be the revision IDs instead of the keys from the input array.

Parameters
bool$indexById
Returns
$this

Definition at line 111 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\$indexById.

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\execute().

◆ revisions()

MediaWiki\CommentFormatter\RevisionCommentBatch::revisions (   $revisions)

Set the revisions to extract comments from.

Parameters
iterable<RevisionRecord>$revisions
Returns
$this

Definition at line 54 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\$revisions.

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\execute().

◆ samePage()

MediaWiki\CommentFormatter\RevisionCommentBatch::samePage (   $samePage = true)

Set the same-page option.

If this is true, section links and fragment- only wikilinks are rendered with an href that is a fragment-only URL. If it is false (the default), such links go to the self link title.

This is equivalent to $local in the old Linker methods.

Parameters
bool$samePage
Returns
$this

Definition at line 69 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\$samePage.

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\execute().

◆ useParentheses()

MediaWiki\CommentFormatter\RevisionCommentBatch::useParentheses (   $useParentheses = true)

Wrap the comment with parentheses.

This has no effect if the useBlock option is not enabled.

Unlike the legacy Linker::commentBlock(), this option defaults to false if this method is not called, since that better preserves the fluent style.

Parameters
bool$useParentheses
Returns
$this

Definition at line 85 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\$useParentheses.

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\execute().

Member Data Documentation

◆ $authority

Authority null MediaWiki\CommentFormatter\RevisionCommentBatch::$authority
private

◆ $formatter

CommentFormatter MediaWiki\CommentFormatter\RevisionCommentBatch::$formatter
private

◆ $indexById

bool MediaWiki\CommentFormatter\RevisionCommentBatch::$indexById = false
private

◆ $isPublic

bool MediaWiki\CommentFormatter\RevisionCommentBatch::$isPublic = false
private

◆ $revisions

iterable<RevisionRecord> MediaWiki\CommentFormatter\RevisionCommentBatch::$revisions
private

◆ $samePage

bool MediaWiki\CommentFormatter\RevisionCommentBatch::$samePage = false
private

◆ $useParentheses

bool MediaWiki\CommentFormatter\RevisionCommentBatch::$useParentheses = false
private

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