MediaWiki  master
RowCommentFormatter.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use CommentStore;
6 use Traversable;
8 
17  private $commentStore;
18 
25  public function __construct(
26  CommentParserFactory $commentParserFactory,
28  ) {
29  parent::__construct( $commentParserFactory );
30  $this->commentStore = $commentStore;
31  }
32 
49  public function rows( $rows ) {
50  return new RowCommentIterator( $this->commentStore, $rows );
51  }
52 
73  public function formatRows( $rows, $commentKey, $namespaceField = null, $titleField = null,
74  $indexField = null, $useBlock = false, $useParentheses = true
75  ) {
76  return $this->createBatch()
77  ->comments(
78  $this->rows( $rows )
79  ->commentKey( $commentKey )
80  ->namespaceField( $namespaceField )
81  ->titleField( $titleField )
82  ->indexField( $indexField )
83  )
84  ->useBlock( $useBlock )
85  ->useParentheses( $useParentheses )
86  ->execute();
87  }
88 }
MediaWiki\CommentFormatter\CommentFormatter\createBatch
createBatch()
Format comments using a fluent interface.
Definition: CommentFormatter.php:34
CommentStore
Handle database storage of comments such as edit summaries and log reasons.
Definition: CommentStore.php:42
MediaWiki\CommentFormatter\CommentFormatter
This is the main service interface for converting single-line comments from various DB comment fields...
Definition: CommentFormatter.php:16
Wikimedia\Rdbms\IResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: IResultWrapper.php:26
MediaWiki\CommentFormatter\RowCommentFormatter\formatRows
formatRows( $rows, $commentKey, $namespaceField=null, $titleField=null, $indexField=null, $useBlock=false, $useParentheses=true)
Format DB rows using a parametric interface.
Definition: RowCommentFormatter.php:73
MediaWiki\CommentFormatter\RowCommentFormatter\$commentStore
CommentStore $commentStore
Definition: RowCommentFormatter.php:17
MediaWiki\CommentFormatter\RowCommentIterator
An adaptor which converts a row iterator into a CommentItem iterator for batch formatting.
Definition: RowCommentIterator.php:24
MediaWiki\CommentFormatter\CommentParserFactory
Definition: CommentParserFactory.php:17
MediaWiki\CommentFormatter\RowCommentFormatter\__construct
__construct(CommentParserFactory $commentParserFactory, CommentStore $commentStore)
Definition: RowCommentFormatter.php:25
MediaWiki\CommentFormatter\RowCommentFormatter
This is basically a CommentFormatter with a CommentStore dependency, allowing it to retrieve comment ...
Definition: RowCommentFormatter.php:15
MediaWiki\CommentFormatter
Definition: CommentBatch.php:3
MediaWiki\CommentFormatter\RowCommentFormatter\rows
rows( $rows)
Format DB rows using a fluent interface.
Definition: RowCommentFormatter.php:49