Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| PerRowAugmentor | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| augmentAll | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Search; |
| 4 | |
| 5 | /** |
| 6 | * Perform augmentation of each row and return composite result, |
| 7 | * indexed by ID. |
| 8 | */ |
| 9 | class PerRowAugmentor implements ResultSetAugmentor { |
| 10 | |
| 11 | private ResultAugmentor $rowAugmentor; |
| 12 | |
| 13 | /** |
| 14 | * @param ResultAugmentor $augmentor Per-result augmentor to use. |
| 15 | */ |
| 16 | public function __construct( ResultAugmentor $augmentor ) { |
| 17 | $this->rowAugmentor = $augmentor; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Produce data to augment search result set. |
| 22 | * @param ISearchResultSet $resultSet |
| 23 | * @return array Data for all results |
| 24 | */ |
| 25 | public function augmentAll( ISearchResultSet $resultSet ) { |
| 26 | $data = []; |
| 27 | foreach ( $resultSet->extractResults() as $result ) { |
| 28 | $id = $result->getTitle()->getArticleID(); |
| 29 | if ( !$id ) { |
| 30 | continue; |
| 31 | } |
| 32 | $data[$id] = $this->rowAugmentor->augment( $result ); |
| 33 | } |
| 34 | return $data; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /** @deprecated class alias since 1.46 */ |
| 39 | class_alias( PerRowAugmentor::class, 'PerRowAugmentor' ); |