Passed
Branch next (ee2197)
by Bas
02:37
created

NormalizesGeoFunctions::normalizeGeoInRange()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 33
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 21
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 20
c 0
b 0
f 0
nc 4
nop 1
dl 0
loc 33
ccs 21
cts 21
cp 1
crap 3
rs 9.6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\FluentAQL\Traits;
6
7
use LaravelFreelancerNL\FluentAQL\QueryBuilder;
8
9
/**
10
 * Trait hasFunctions.
11
 *
12
 * AQL Function API calls.
13
 */
14
trait NormalizesGeoFunctions
15
{
16
    abstract protected function normalizeNumbers(QueryBuilder $queryBuilder);
17
18 2
    protected function normalizeDistance(QueryBuilder $queryBuilder): void
19
    {
20 2
        $this->normalizeNumbers($queryBuilder);
21 2
    }
22
23 1
    protected function normalizeGeoArea(QueryBuilder $queryBuilder): void
24
    {
25 1
        $this->parameters[0] = $queryBuilder->normalizeArgument(
0 ignored issues
show
Bug Best Practice introduced by
The property parameters does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
26 1
            $this->parameters[0],
27 1
            ['Object', 'Query', 'Reference', 'Bind']
28
        );
29
30 1
        $this->parameters[1] = $queryBuilder->normalizeArgument(
31 1
            $this->parameters[1],
32 1
            ['Query', 'Reference', 'Bind']
33
        );
34 1
    }
35
36 1
    protected function normalizeGeoContains(QueryBuilder $queryBuilder): void
37
    {
38 1
        $this->parameters[0] = $queryBuilder->normalizeArgument(
0 ignored issues
show
Bug Best Practice introduced by
The property parameters does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
39 1
            $this->parameters[0],
40 1
            ['Object', 'Query', 'Reference', 'Bind']
41
        );
42
43 1
        $this->parameters[1] = $queryBuilder->normalizeArgument(
44 1
            $this->parameters[1],
45 1
            ['Query', 'Reference', 'Bind']
46
        );
47 1
    }
48 1
    protected function normalizeGeoDistance(QueryBuilder $queryBuilder): void
49
    {
50 1
        $this->parameters[0] = $queryBuilder->normalizeArgument(
0 ignored issues
show
Bug Best Practice introduced by
The property parameters does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
51 1
            $this->parameters[0],
52 1
            ['Object', 'Query', 'Reference', 'Bind']
53
        );
54
55 1
        $this->parameters[1] = $queryBuilder->normalizeArgument(
56 1
            $this->parameters[1],
57 1
            ['Object', 'Query', 'Reference', 'Bind']
58
        );
59
60 1
        $this->parameters[2] = $queryBuilder->normalizeArgument(
61 1
            $this->parameters[2],
62 1
            ['Query', 'Reference', 'Bind']
63
        );
64 1
    }
65
66 1
    protected function normalizeGeoEquals(QueryBuilder $queryBuilder): void
67
    {
68 1
        $this->parameters[0] = $queryBuilder->normalizeArgument(
0 ignored issues
show
Bug Best Practice introduced by
The property parameters does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
69 1
            $this->parameters[0],
70 1
            ['Object', 'Query', 'Reference', 'Bind']
71
        );
72
73 1
        $this->parameters[1] = $queryBuilder->normalizeArgument(
74 1
            $this->parameters[1],
75 1
            ['Query', 'Reference', 'Bind']
76
        );
77 1
    }
78
79 1
    protected function normalizeGeoIntersects(QueryBuilder $queryBuilder): void
80
    {
81 1
        $this->parameters[0] = $queryBuilder->normalizeArgument(
0 ignored issues
show
Bug Best Practice introduced by
The property parameters does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
82 1
            $this->parameters[0],
83 1
            ['Object', 'Query', 'Reference', 'Bind']
84
        );
85
86 1
        $this->parameters[1] = $queryBuilder->normalizeArgument(
87 1
            $this->parameters[1],
88 1
            ['Query', 'Reference', 'Bind']
89
        );
90 1
    }
91
92 2
    protected function normalizeGeoInRange(QueryBuilder $queryBuilder): void
93
    {
94 2
        $this->parameters['geoJsonA'] = $queryBuilder->normalizeArgument(
0 ignored issues
show
Bug Best Practice introduced by
The property parameters does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
95 2
            $this->parameters['geoJsonA'],
96 2
            ['Object', 'Query', 'Reference', 'Bind']
97
        );
98
99 2
        $this->parameters['geoJsonB'] = $queryBuilder->normalizeArgument(
100 2
            $this->parameters['geoJsonB'],
101 2
            ['Object', 'Query', 'Reference', 'Bind']
102
        );
103
104 2
        $this->parameters['low'] = $queryBuilder->normalizeArgument(
105 2
            $this->parameters['low'],
106 2
            ['Number', 'Query', 'Reference', 'Bind']
107
        );
108
109 2
        $this->parameters['high'] = $queryBuilder->normalizeArgument(
110 2
            $this->parameters['high'],
111 2
            ['Number', 'Query', 'Reference', 'Bind']
112
        );
113
114 2
        if (isset($this->parameters['includeLow'])) {
115 1
            $this->parameters['includeLow'] = $queryBuilder->normalizeArgument(
116 1
                $this->parameters['includeLow'],
117 1
                ['Boolean', 'Query', 'Reference', 'Bind']
118
            );
119
        }
120
121 2
        if (isset($this->parameters['includeHigh'])) {
122 1
            $this->parameters['includeHigh'] = $queryBuilder->normalizeArgument(
123 1
                $this->parameters['includeHigh'],
124 1
                ['Boolean', 'Query', 'Reference', 'Bind']
125
            );
126
        }
127 2
    }
128
129 1
    protected function normalizeGeoLineString(QueryBuilder $queryBuilder): void
130
    {
131 1
        $this->normalizeArrays($queryBuilder);
0 ignored issues
show
Bug introduced by
The method normalizeArrays() does not exist on LaravelFreelancerNL\Flue...\NormalizesGeoFunctions. Did you maybe mean normalizeGeoArea()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

131
        $this->/** @scrutinizer ignore-call */ 
132
               normalizeArrays($queryBuilder);

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.

Loading history...
132 1
    }
133
134 1
    protected function normalizeGeoMultiLineString(QueryBuilder $queryBuilder): void
135
    {
136 1
        $this->normalizeArrays($queryBuilder);
137 1
    }
138
139 1
    protected function normalizeGeoPoint(QueryBuilder $queryBuilder): void
140
    {
141 1
        $this->normalizeNumbers($queryBuilder);
142 1
    }
143
144 1
    protected function normalizeGeoMultiPoint(QueryBuilder $queryBuilder): void
145
    {
146 1
        $this->normalizeArrays($queryBuilder);
147 1
    }
148
149 1
    protected function normalizeGeoPolygon(QueryBuilder $queryBuilder): void
150
    {
151 1
        $this->normalizeArrays($queryBuilder);
152 1
    }
153
154 1
    protected function normalizeGeoMultiPolygon(QueryBuilder $queryBuilder): void
155
    {
156 1
        $this->normalizeArrays($queryBuilder);
157 1
    }
158
}
159