MediaWiki  master
MediaWiki\CommentFormatter\RowCommentIterator Class Reference

An adaptor which converts a row iterator into a CommentItem iterator for batch formatting. More...

Inheritance diagram for MediaWiki\CommentFormatter\RowCommentIterator:
Collaboration diagram for MediaWiki\CommentFormatter\RowCommentIterator:

Public Member Functions

 __construct (CommentStore $commentStore, $rows)
 
 commentKey ( $key)
 Set what CommentStore calls the key – typically a legacy field name which once held a comment. More...
 
 current ()
 
 indexField ( $field)
 Set the index field. More...
 
 key ()
 
 namespaceField ( $field)
 Set the namespace field. More...
 
 titleField ( $field)
 Set the title field. More...
 

Private Attributes

string null $commentKey
 
CommentStore $commentStore
 
string null $indexField
 
string null $namespaceField
 
string null $titleField
 

Detailed Description

An adaptor which converts a row iterator into a CommentItem iterator for batch formatting.

Fluent-style mutators are provided to configure how comment text is extracted from rows.

Using an iterator for this configuration, instead of putting the options in CommentBatch, allows CommentBatch to be a simple single class without a CommentStore dependency.

Since
1.38

Definition at line 24 of file RowCommentIterator.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\CommentFormatter\RowCommentIterator::__construct ( CommentStore  $commentStore,
  $rows 
)
Access: internal
Use RowCommentFormatter::rows()
Parameters
CommentStore$commentStore
Traversable | array$rows

Definition at line 41 of file RowCommentIterator.php.

References MediaWiki\CommentFormatter\RowCommentIterator\$commentStore.

Member Function Documentation

◆ commentKey()

MediaWiki\CommentFormatter\RowCommentIterator::commentKey (   $key)

Set what CommentStore calls the key – typically a legacy field name which once held a comment.

This must be called before attempting iteration.

Parameters
string$key
Returns
$this

Definition at line 59 of file RowCommentIterator.php.

◆ current()

MediaWiki\CommentFormatter\RowCommentIterator::current ( )

Definition at line 109 of file RowCommentIterator.php.

◆ indexField()

MediaWiki\CommentFormatter\RowCommentIterator::indexField (   $field)

Set the index field.

Values from this field will appear as array keys in the final formatted comment array. If unset, the array will be numerically indexed.

Parameters
string$field
Returns
$this

Definition at line 96 of file RowCommentIterator.php.

Referenced by MediaWiki\CommentFormatter\RowCommentIterator\key().

◆ key()

MediaWiki\CommentFormatter\RowCommentIterator::key ( )

◆ namespaceField()

MediaWiki\CommentFormatter\RowCommentIterator::namespaceField (   $field)

Set the namespace field.

If this is not called, the item will not have a self-link target, although it may be provided by the batch.

Parameters
string$field
Returns
$this

Definition at line 71 of file RowCommentIterator.php.

◆ titleField()

MediaWiki\CommentFormatter\RowCommentIterator::titleField (   $field)

Set the title field.

If this is not called, the item will not have a self-link target, although it may be provided by the batch.

Parameters
string$field
Returns
$this

Definition at line 83 of file RowCommentIterator.php.

Member Data Documentation

◆ $commentKey

string null MediaWiki\CommentFormatter\RowCommentIterator::$commentKey
private

Definition at line 28 of file RowCommentIterator.php.

◆ $commentStore

CommentStore MediaWiki\CommentFormatter\RowCommentIterator::$commentStore
private

◆ $indexField

string null MediaWiki\CommentFormatter\RowCommentIterator::$indexField
private

Definition at line 34 of file RowCommentIterator.php.

◆ $namespaceField

string null MediaWiki\CommentFormatter\RowCommentIterator::$namespaceField
private

Definition at line 30 of file RowCommentIterator.php.

◆ $titleField

string null MediaWiki\CommentFormatter\RowCommentIterator::$titleField
private

Definition at line 32 of file RowCommentIterator.php.


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