| Total Complexity | 7 |
| Total Lines | 116 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | trait HandlesAqlGrammar |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Available predicate operators. |
||
| 11 | * |
||
| 12 | * @var array<string, int> |
||
| 13 | */ |
||
| 14 | protected array $comparisonOperators = [ |
||
| 15 | '==' => 1, |
||
| 16 | '!=' => 1, |
||
| 17 | '<' => 1, |
||
| 18 | '>' => 1, |
||
| 19 | '<=' => 1, |
||
| 20 | '>=' => 1, |
||
| 21 | 'IN' => 1, |
||
| 22 | 'NOT IN' => 1, |
||
| 23 | 'LIKE' => 1, |
||
| 24 | '~' => 1, |
||
| 25 | '!~' => 1, |
||
| 26 | 'ALL ==' => 1, |
||
| 27 | 'ALL !=' => 1, |
||
| 28 | 'ALL <' => 1, |
||
| 29 | 'ALL >' => 1, |
||
| 30 | 'ALL <=' => 1, |
||
| 31 | 'ALL >=' => 1, |
||
| 32 | 'ALL IN' => 1, |
||
| 33 | 'ANY ==' => 1, |
||
| 34 | 'ANY !=' => 1, |
||
| 35 | 'ANY <' => 1, |
||
| 36 | 'ANY >' => 1, |
||
| 37 | 'ANY <=' => 1, |
||
| 38 | 'ANY >=' => 1, |
||
| 39 | 'ANY IN' => 1, |
||
| 40 | 'NONE ==' => 1, |
||
| 41 | 'NONE !=' => 1, |
||
| 42 | 'NONE <' => 1, |
||
| 43 | 'NONE >' => 1, |
||
| 44 | 'NONE <=' => 1, |
||
| 45 | 'NONE >=' => 1, |
||
| 46 | 'NONE IN' => 1, |
||
| 47 | ]; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @var array|int[] |
||
| 51 | */ |
||
| 52 | protected array $arithmeticOperators = [ |
||
| 53 | '+' => 1, |
||
| 54 | '-' => 1, |
||
| 55 | '*' => 1, |
||
| 56 | '/' => 1, |
||
| 57 | '%' => 1, |
||
| 58 | ]; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @var array|int[] |
||
| 62 | */ |
||
| 63 | protected array $logicalOperators = [ |
||
| 64 | 'AND' => 1, |
||
| 65 | '&&' => 1, |
||
| 66 | 'OR' => 1, |
||
| 67 | '||' => 1, |
||
| 68 | 'NOT' => 1, |
||
| 69 | '!' => 1, |
||
| 70 | ]; |
||
| 71 | |||
| 72 | protected string $rangeOperator = '..'; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Get the format for database stored dates. |
||
| 76 | * |
||
| 77 | * @return string |
||
| 78 | */ |
||
| 79 | public function getDateFormat(): string |
||
| 80 | { |
||
| 81 | return 'Y-m-d\TH:i:s.vp'; |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Get the appropriate query parameter place-holder for a value. |
||
| 86 | * |
||
| 87 | * @param mixed $value |
||
| 88 | */ |
||
| 89 | public function parameter($value): string |
||
| 90 | { |
||
| 91 | return $this->isExpression($value) ? $this->getValue($value) : (string) $value; |
||
| 92 | } |
||
| 93 | |||
| 94 | |||
| 95 | /** |
||
| 96 | * Quote the given string literal. |
||
| 97 | * |
||
| 98 | * @param string|array $value |
||
| 99 | * @return string |
||
| 100 | */ |
||
| 101 | public function quoteString($value) |
||
| 108 | } |
||
| 109 | |||
| 110 | /** |
||
| 111 | * Wrap a single string in keyword identifiers. |
||
| 112 | * |
||
| 113 | * @param string $value |
||
| 114 | * @return string |
||
| 115 | */ |
||
| 116 | protected function wrapValue($value) |
||
| 126 |