1 | <?php |
||||||
2 | |||||||
3 | declare(strict_types=1); |
||||||
4 | |||||||
5 | namespace LaravelFreelancerNL\FluentAQL\Traits; |
||||||
6 | |||||||
7 | use LaravelFreelancerNL\FluentAQL\Expressions\PredicateExpression; |
||||||
8 | use LaravelFreelancerNL\FluentAQL\QueryBuilder; |
||||||
9 | |||||||
10 | /** |
||||||
11 | * Trait hasFunctions. |
||||||
12 | * |
||||||
13 | * AQL Function API calls. |
||||||
14 | */ |
||||||
15 | trait NormalizesMiscellaneousFunctions |
||||||
16 | { |
||||||
17 | 4 | protected function normalizeAssert(QueryBuilder $queryBuilder): void |
|||||
18 | { |
||||||
19 | if ( |
||||||
20 | 4 | ! is_array($this->parameters['predicates']) |
|||||
21 | 4 | && ! $this->parameters['predicates'] instanceof PredicateExpression |
|||||
22 | ) { |
||||||
23 | $this->parameters['predicates'] = [$this->parameters['predicates']]; |
||||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||||||
24 | } |
||||||
25 | 4 | $this->parameters['predicates'] = $queryBuilder->normalizePredicates($this->parameters['predicates']); |
|||||
26 | 4 | $this->parameters['errorMessage'] = $queryBuilder->normalizeArgument( |
|||||
27 | 4 | $this->parameters['errorMessage'], |
|||||
28 | 4 | ['Reference', 'Query', 'Bind'] |
|||||
29 | ); |
||||||
30 | } |
||||||
31 | |||||||
32 | 1 | protected function normalizeDocument(QueryBuilder $queryBuilder): void |
|||||
33 | { |
||||||
34 | 1 | if ($this->parameters['id'] === null) { |
|||||
35 | 1 | $this->parameters['id'] = $this->parameters['collection']; |
|||||
0 ignored issues
–
show
|
|||||||
36 | 1 | unset($this->parameters['collection']); |
|||||
37 | } |
||||||
38 | |||||||
39 | 1 | if (isset($this->parameters['collection'])) { |
|||||
40 | 1 | $this->parameters['collection'] = $queryBuilder->normalizeArgument( |
|||||
41 | 1 | $this->parameters['collection'], |
|||||
42 | 1 | ['Collection', 'Id', 'Query', 'Bind'] |
|||||
43 | ); |
||||||
44 | } |
||||||
45 | 1 | $this->parameters['id'] = $queryBuilder->normalizeArgument( |
|||||
46 | 1 | $this->parameters['id'], |
|||||
47 | 1 | ['RegisteredVariable', 'Reference', 'Id', 'Key', 'Query', 'List', 'Bind'] |
|||||
48 | ); |
||||||
49 | } |
||||||
50 | |||||||
51 | 1 | protected function normalizeFirstDocument(QueryBuilder $queryBuilder): void |
|||||
52 | { |
||||||
53 | 1 | $this->normalizeAny($queryBuilder); |
|||||
0 ignored issues
–
show
The method
normalizeAny() does not exist on LaravelFreelancerNL\Flue...sMiscellaneousFunctions . Did you maybe mean normalizeWarn() ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
54 | } |
||||||
55 | |||||||
56 | 2 | protected function normalizeWarn(QueryBuilder $queryBuilder): void |
|||||
57 | { |
||||||
58 | 2 | $this->normalizeAssert($queryBuilder); |
|||||
59 | } |
||||||
60 | } |
||||||
61 |