Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
Util | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
parameterName | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
addParentheses | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Projom\Storage\SQL\Component\Filter; |
6 | |
7 | use Projom\Storage\SQL\Util as SQLUtil; |
8 | |
9 | class Util extends SQLUtil |
10 | { |
11 | public static function parameterName(array $columns, int $id): string |
12 | { |
13 | $colString = static::join($columns, '_'); |
14 | $colString = str_replace(['.', ','], '_', $colString); |
15 | $colString = strtolower($colString); |
16 | return "filter_{$colString}_{$id}"; |
17 | } |
18 | |
19 | public static function addParentheses(array $filter): array |
20 | { |
21 | $filterCount = count($filter); |
22 | |
23 | if ($filterCount > 1) { |
24 | array_unshift($filter, '('); |
25 | $filter[] = ')'; |
26 | } |
27 | |
28 | return $filter; |
29 | } |
30 | } |