| Total Complexity | 8 |
| Total Lines | 96 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class TermsQuery extends QueryAbstract |
||
| 11 | { |
||
| 12 | const NAME = 'terms'; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $field; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var array |
||
| 21 | */ |
||
| 22 | private $values; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $field |
||
| 26 | * @param array $values |
||
| 27 | */ |
||
| 28 | public function __construct(string $field, array $values) |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param null|string $index |
||
| 36 | * |
||
| 37 | * @return $this |
||
| 38 | */ |
||
| 39 | public function index(?string $index) |
||
| 40 | { |
||
| 41 | $this->options[__FUNCTION__] = $index; |
||
| 42 | |||
| 43 | return $this; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @param null|string $type |
||
| 48 | * |
||
| 49 | * @return $this |
||
| 50 | */ |
||
| 51 | public function type(?string $type) |
||
| 52 | { |
||
| 53 | $this->options[__FUNCTION__] = $type; |
||
| 54 | |||
| 55 | return $this; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @param null|string $id |
||
| 60 | * |
||
| 61 | * @return $this |
||
| 62 | */ |
||
| 63 | public function id(?string $id) |
||
| 64 | { |
||
| 65 | $this->options[__FUNCTION__] = $id; |
||
| 66 | |||
| 67 | return $this; |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @param null|string $path |
||
| 72 | * |
||
| 73 | * @return $this |
||
| 74 | */ |
||
| 75 | public function path(?string $path) |
||
| 76 | { |
||
| 77 | $this->options[__FUNCTION__] = $path; |
||
| 78 | |||
| 79 | return $this; |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @param null|string $routing |
||
| 84 | * |
||
| 85 | * @return $this |
||
| 86 | */ |
||
| 87 | public function routing(?string $routing) |
||
| 88 | { |
||
| 89 | $this->options[__FUNCTION__] = $routing; |
||
| 90 | |||
| 91 | return $this; |
||
| 92 | } |
||
| 93 | |||
| 94 | /** |
||
| 95 | * @inheritdoc |
||
| 96 | */ |
||
| 97 | public function jsonSerialize() |
||
| 106 | } |
||
| 107 | } |
||
| 108 |
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.