Total Complexity | 3 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
14 | final class TermFilter implements QueryInterface |
||
15 | { |
||
16 | private array $query; |
||
17 | |||
18 | /** @param array $term */ |
||
19 | public static function fromNative($term): QueryInterface |
||
20 | { |
||
21 | Assert::that($term)->isArray('Must be an array.')->notEmpty('Must not be empty.'); |
||
22 | return new self(key($term), current($term)); |
||
23 | } |
||
24 | |||
25 | public function toNative(): array |
||
26 | { |
||
27 | return $this->query; |
||
28 | } |
||
29 | |||
30 | private function __construct(string $term, string $value) |
||
37 | ] |
||
38 | ] |
||
39 | ] |
||
43 |