Having such comments is worse than not having them. They add zero information. But you must read the text to understand there is nothing you don't already know from the class and the method name. Change-Id: I994d11e05f202b880390723e148d79c72cca29f0
37 lines
819 B
PHP
37 lines
819 B
PHP
<?php
|
|
|
|
/**
|
|
* Perform augmentation of each row and return composite result,
|
|
* indexed by ID.
|
|
*/
|
|
class PerRowAugmentor implements ResultSetAugmentor {
|
|
|
|
/**
|
|
* @var ResultAugmentor
|
|
*/
|
|
private $rowAugmentor;
|
|
|
|
/**
|
|
* @param ResultAugmentor $augmentor Per-result augmentor to use.
|
|
*/
|
|
public function __construct( ResultAugmentor $augmentor ) {
|
|
$this->rowAugmentor = $augmentor;
|
|
}
|
|
|
|
/**
|
|
* Produce data to augment search result set.
|
|
* @param SearchResultSet $resultSet
|
|
* @return array Data for all results
|
|
*/
|
|
public function augmentAll( SearchResultSet $resultSet ) {
|
|
$data = [];
|
|
foreach ( $resultSet->extractResults() as $result ) {
|
|
$id = $result->getTitle()->getArticleID();
|
|
if ( !$id ) {
|
|
continue;
|
|
}
|
|
$data[$id] = $this->rowAugmentor->augment( $result );
|
|
}
|
|
return $data;
|
|
}
|
|
}
|