| 1 | <?php |
||
| 14 | class ElasticsearchAdapter implements AdapterInterface |
||
| 15 | { |
||
| 16 | |||
| 17 | /** |
||
| 18 | * The Elasticsearch query parameters. |
||
| 19 | * |
||
| 20 | * @var array |
||
| 21 | */ |
||
| 22 | private $params; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * The Elasticsearch results |
||
| 26 | * |
||
| 27 | * @var array |
||
| 28 | */ |
||
| 29 | private $results; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * The Elasticsearch client. |
||
| 33 | * |
||
| 34 | * @var Client |
||
| 35 | */ |
||
| 36 | private $client; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Constructor. |
||
| 40 | * |
||
| 41 | * @param array $params The array of parameters to use for performing the search. |
||
| 42 | * @param Client $client The Elasticsearch client. |
||
| 43 | */ |
||
| 44 | public function __construct(array $params, $client) |
||
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | public function getNbResults() |
||
| 60 | |||
| 61 | /** |
||
| 62 | * {@inheritdoc} |
||
| 63 | */ |
||
| 64 | public function getSlice($offset, $length) |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Runs the query and stores the results. |
||
| 75 | * |
||
| 76 | * @param array $params |
||
| 77 | */ |
||
| 78 | private function runQuery($params = array()) |
||
| 85 | } |
||
| 86 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.