Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
10 / 10 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Standard | |
100.00% |
10 / 10 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| create | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| filter | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Projom\Storage\SQL\Component\Filter; |
| 6 | |
| 7 | use Projom\Storage\SQL\Component\Column; |
| 8 | use Projom\Storage\SQL\Util\Operator; |
| 9 | |
| 10 | class Standard |
| 11 | { |
| 12 | public static function create(Column $column, Operator $operator, mixed $value, int $filterID): array |
| 13 | { |
| 14 | $parameterName = Util::parameterName($column->fields(), $filterID); |
| 15 | |
| 16 | $filter = static::filter($column, $operator, $parameterName); |
| 17 | |
| 18 | $params = [ |
| 19 | $parameterName => $value |
| 20 | ]; |
| 21 | |
| 22 | return [ |
| 23 | $filter, |
| 24 | $params |
| 25 | ]; |
| 26 | } |
| 27 | |
| 28 | public static function filter(Column $column, Operator $operator, string $parameterName): string |
| 29 | { |
| 30 | return "$column {$operator->value} :{$parameterName}"; |
| 31 | } |
| 32 | } |