| 1 | <?php |
||
| 12 | class SearchResult extends ParameterArrayConstructor implements JsonSerializable |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * URL of the search result |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | protected $url; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Description of result's relevance |
||
| 22 | * @var Relevance |
||
| 23 | */ |
||
| 24 | protected $relevance; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Human-readable title |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | protected $title; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Human-readable description |
||
| 34 | * |
||
| 35 | * Ideally 20-100 words, may be HTML-formatted (although links should be |
||
| 36 | * stripped out). |
||
| 37 | * @var string |
||
| 38 | */ |
||
| 39 | protected $description; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Simplified description of search domain source of the result |
||
| 43 | * @var SearchSource |
||
| 44 | */ |
||
| 45 | protected $source; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Construct a SearchResult |
||
| 49 | * |
||
| 50 | * Expects an associative parameter array: |
||
| 51 | * |
||
| 52 | * ``` |
||
| 53 | * [ |
||
| 54 | * 'url' => URL of the search result as a string, |
||
| 55 | * 'title' => Title of the search result as a string, |
||
| 56 | * 'relevance' => instance of `Relevance`, |
||
| 57 | * 'source' => instance of `SearchSource`, |
||
| 58 | * 'description' => Optional: search result descriptin as a string |
||
| 59 | * ] |
||
| 60 | * ``` |
||
| 61 | * |
||
| 62 | * @param mixed[string] $params |
||
|
1 ignored issue
–
show
|
|||
| 63 | */ |
||
| 64 | public function __construct($params) |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Sort into order of descending relevance |
||
| 78 | * |
||
| 79 | * @param SearchResult[] $results |
||
| 80 | * @return void |
||
| 81 | */ |
||
| 82 | public static function sort(&$results) |
||
| 94 | |||
| 95 | public function jsonSerialize() |
||
| 105 | } |
||
| 106 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.