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

NormalizesDateFunctions::normalizeDateLocalToUtc()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 10
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 16
ccs 11
cts 11
cp 1
crap 2
rs 9.9332
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 NormalizesDateFunctions
15
{
16 1
    protected function normalizeDateCompare(QueryBuilder $queryBuilder): void
17
    {
18 1
        $this->parameters['date1'] = $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...
19 1
            $this->parameters['date1'],
20 1
            ['Number', 'Query', 'Reference', 'Bind']
21
        );
22
23 1
        $this->parameters['date2'] = $queryBuilder->normalizeArgument(
24 1
            $this->parameters['date2'],
25 1
            ['Number', 'Query', 'Reference', 'Bind']
26
        );
27
28 1
        $this->parameters['unitRangeStart'] = $queryBuilder->normalizeArgument(
29 1
            $this->parameters['unitRangeStart'],
30 1
            ['Query', 'Reference', 'Bind']
31
        );
32
33 1
        if (isset($this->parameters['unitRangeEnd'])) {
34 1
            $this->parameters['unitRangeEnd'] = $queryBuilder->normalizeArgument(
35 1
                $this->parameters['unitRangeEnd'],
36 1
                ['Query', 'Reference', 'Bind']
37
            );
38
        }
39 1
    }
40
41 1
    protected function normalizeDateDay(QueryBuilder $queryBuilder): void
42
    {
43 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...
44 1
            $this->parameters[0],
45 1
            ['Number', 'Function', 'Query', 'Reference', 'Bind']
46
        );
47 1
    }
48
49 1
    protected function normalizeDateFormat(QueryBuilder $queryBuilder): void
50
    {
51 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...
52 1
            $this->parameters[0],
53 1
            ['Number', 'Function', 'Query', 'Reference', 'Bind']
54
        );
55
56 1
        $this->parameters[1] = $queryBuilder->normalizeArgument(
57 1
            $this->parameters[1],
58 1
            ['Function', 'Query', 'Reference', 'Bind']
59
        );
60 1
    }
61
62 1
    protected function normalizeDateHour(QueryBuilder $queryBuilder): void
63
    {
64 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...
65 1
            $this->parameters[0],
66 1
            ['Number', 'Function', 'Query', 'Reference', 'Bind']
67
        );
68 1
    }
69
70 3
    protected function normalizeDateIso8601(QueryBuilder $queryBuilder): void
71
    {
72 3
        $this->normalizeNumbers($queryBuilder);
0 ignored issues
show
Bug introduced by
The method normalizeNumbers() does not exist on LaravelFreelancerNL\Flue...NormalizesDateFunctions. Did you maybe mean normalizeDateHour()? ( Ignorable by Annotation )

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

72
        $this->/** @scrutinizer ignore-call */ 
73
               normalizeNumbers($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...
73 3
    }
74
75 1
    protected function normalizeDateMillisecond(QueryBuilder $queryBuilder): void
76
    {
77 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...
78 1
            $this->parameters[0],
79 1
            ['Number', 'Function', 'Query', 'Reference', 'Bind']
80
        );
81 1
    }
82
83 1
    protected function normalizeDateMinute(QueryBuilder $queryBuilder): void
84
    {
85 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...
86 1
            $this->parameters[0],
87 1
            ['Number', 'Function', 'Query', 'Reference', 'Bind']
88
        );
89 1
    }
90
91 1
    protected function normalizeDateMonth(QueryBuilder $queryBuilder): void
92
    {
93 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...
94 1
            $this->parameters[0],
95 1
            ['Number', 'Function', 'Query', 'Reference', 'Bind']
96
        );
97 1
    }
98
99 1
    protected function normalizeDateSecond(QueryBuilder $queryBuilder): void
100
    {
101 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...
102 1
            $this->parameters[0],
103 1
            ['Number', 'Function', 'Query', 'Reference', 'Bind']
104
        );
105 1
    }
106
107 3
    protected function normalizeDateTimestamp(QueryBuilder $queryBuilder): void
108
    {
109 3
        $this->normalizeNumbers($queryBuilder);
110 3
    }
111
112 2
    protected function normalizeDateUtcToLocal(QueryBuilder $queryBuilder): void
113
    {
114 2
        $this->parameters['date'] = $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...
115 2
            $this->parameters['date'],
116 2
            ['Number', 'Query', 'Reference', 'Bind']
117
        );
118
119 2
        $this->parameters['timezone'] = $queryBuilder->normalizeArgument(
120 2
            $this->parameters['timezone'],
121 2
            ['Query', 'Reference', 'Bind']
122
        );
123
124 2
        if (isset($this->parameters['zoneInfo'])) {
125 1
            $this->parameters['zoneInfo'] = $queryBuilder->normalizeArgument(
126 1
                $this->parameters['zoneInfo'],
127 1
                ['Object', 'Query', 'Reference', 'Bind']
128
            );
129
        }
130 2
    }
131
132
133 2
    protected function normalizeDateLocalToUtc(QueryBuilder $queryBuilder): void
134
    {
135 2
        $this->parameters['date'] = $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...
136 2
            $this->parameters['date'],
137 2
            ['Number', 'Query', 'Reference', 'Bind']
138
        );
139
140 2
        $this->parameters['timezone'] = $queryBuilder->normalizeArgument(
141 2
            $this->parameters['timezone'],
142 2
            ['Query', 'Reference', 'Bind']
143
        );
144
145 2
        if (isset($this->parameters['zoneInfo'])) {
146 1
            $this->parameters['zoneInfo'] = $queryBuilder->normalizeArgument(
147 1
                $this->parameters['zoneInfo'],
148 1
                ['Object', 'Query', 'Reference', 'Bind']
149
            );
150
        }
151 2
    }
152
153 1
    protected function normalizeDateTrunc(QueryBuilder $queryBuilder): void
154
    {
155 1
        $this->parameters['date'] = $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...
156 1
            $this->parameters['date'],
157 1
            ['Number', 'Query', 'Reference', 'Bind']
158
        );
159
160 1
        $this->parameters['unit'] = $queryBuilder->normalizeArgument(
161 1
            $this->parameters['unit'],
162 1
            ['Query', 'Reference', 'Bind']
163
        );
164 1
    }
165
166 2
    protected function normalizeDateRound(QueryBuilder $queryBuilder): void
167
    {
168 2
        $this->parameters['date'] = $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...
169 2
            $this->parameters['date'],
170 2
            ['Number', 'Query', 'Reference', 'Bind']
171
        );
172
173 2
        $this->parameters['amount'] = $queryBuilder->normalizeArgument(
174 2
            $this->parameters['amount'],
175 2
            ['Number', 'Query', 'Reference', 'Bind']
176
        );
177
178 2
        $this->parameters['unit'] = $queryBuilder->normalizeArgument(
179 2
            $this->parameters['unit'],
180 2
            ['Query', 'Reference', 'Bind']
181
        );
182 2
    }
183
184 1
    protected function normalizeDateYear(QueryBuilder $queryBuilder): void
185
    {
186 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...
187 1
            $this->parameters[0],
188 1
            ['Number', 'Function', 'Query', 'Reference', 'Bind']
189
        );
190 1
    }
191
}
192