MediaWiki REL1_40
MediaWiki\CommentFormatter\RowCommentIterator Class Reference

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

Inherits IteratorIterator.

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.
 
 current ()
 
 indexField ( $field)
 Set the index field.
 
 key ()
 
 namespaceField ( $field)
 Set the namespace field.
 
 titleField ( $field)
 Set the title field.
 

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.

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.

References MediaWiki\CommentFormatter\RowCommentIterator\commentKey().

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

◆ 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.

References MediaWiki\CommentFormatter\RowCommentIterator\indexField().

Referenced by MediaWiki\CommentFormatter\RowCommentIterator\indexField(), and 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.

References MediaWiki\CommentFormatter\RowCommentIterator\namespaceField().

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

◆ 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.

References MediaWiki\CommentFormatter\RowCommentIterator\titleField().

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


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