| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\CommentFormatter; |
| 4 | |
| 5 | use ArrayIterator; |
| 6 | |
| 7 | /** |
| 8 | * An adaptor which converts an array of strings to an iterator of CommentItem |
| 9 | * objects. |
| 10 | * |
| 11 | * @since 1.38 |
| 12 | */ |
| 13 | class StringCommentIterator extends ArrayIterator { |
| 14 | /** |
| 15 | * @internal Use CommentBatch::strings() |
| 16 | * @param string[] $strings |
| 17 | */ |
| 18 | public function __construct( $strings ) { |
| 19 | parent::__construct( $strings ); |
| 20 | } |
| 21 | |
| 22 | public function current(): CommentItem { |
| 23 | return new CommentItem( parent::current() ); |
| 24 | } |
| 25 | } |