| 1 | <?php |
||
| 22 | class FuzzyQuery implements BuilderInterface |
||
| 23 | { |
||
| 24 | use ParametersTrait; |
||
| 25 | |||
| 26 | public function __construct( |
||
| 27 | private string $field, |
||
|
|
|||
| 28 | private string $value, |
||
| 29 | array $parameters = [] |
||
| 30 | ) { |
||
| 31 | $this->setParameters($parameters); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function getType(): string |
||
| 35 | { |
||
| 36 | return 'fuzzy'; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function toArray(): array |
||
| 40 | { |
||
| 41 | $query = [ |
||
| 42 | 'value' => $this->value, |
||
| 43 | ]; |
||
| 44 | |||
| 45 | $output = [ |
||
| 46 | $this->field => $this->processArray($query), |
||
| 47 | ]; |
||
| 48 | |||
| 49 | return [$this->getType() => $output]; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |