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

NormalizesStringFunctions::normalizeUpper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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 NormalizesStringFunctions
15
{
16
    abstract protected function normalizeNumbers(QueryBuilder $queryBuilder);
17
18 1
    protected function normalizeConcat(QueryBuilder $queryBuilder): void
19
    {
20 1
        $this->normalizeStrings($queryBuilder);
0 ignored issues
show
Bug introduced by
The method normalizeStrings() does not exist on LaravelFreelancerNL\Flue...rmalizesStringFunctions. Did you maybe mean normalizeSubstring()? ( Ignorable by Annotation )

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

20
        $this->/** @scrutinizer ignore-call */ 
21
               normalizeStrings($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...
21 1
    }
22
23 1
    protected function normalizeConcatSeparator(QueryBuilder $queryBuilder): void
24
    {
25 1
        $this->normalizeStrings($queryBuilder);
26 1
    }
27
28 2
    protected function normalizeContains(QueryBuilder $queryBuilder): void
29
    {
30 2
        $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...
31 2
            $this->parameters[0],
32 2
            ['Query', 'Reference', 'Bind']
33
        );
34
35 2
        $this->parameters[1] = $queryBuilder->normalizeArgument(
36 2
            $this->parameters[1],
37 2
            ['Query', 'Reference', 'Bind']
38
        );
39
40 2
        $this->parameters[2] = $queryBuilder->normalizeArgument(
41 2
            $this->parameters[2],
42 2
            ['Boolean', 'Query', 'Reference', 'Bind']
43
        );
44 2
    }
45
46 1
    protected function normalizeLevenshteinDistance(QueryBuilder $queryBuilder): void
47
    {
48 1
        $this->normalizeStrings($queryBuilder);
49 1
    }
50
51 1
    protected function normalizeLower(QueryBuilder $queryBuilder): void
52
    {
53 1
        $this->normalizeStrings($queryBuilder);
54 1
    }
55
56 1
    protected function normalizeRegexMatches(QueryBuilder $queryBuilder): void
57
    {
58 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...
59 1
            $this->parameters[0],
60 1
            ['Query', 'Reference', 'Bind']
61
        );
62
63 1
        $this->parameters[1] = $queryBuilder->normalizeArgument(
64 1
            $this->parameters[1],
65 1
            ['Query', 'Reference', 'Bind']
66
        );
67
68 1
        $this->parameters[2] = $queryBuilder->normalizeArgument(
69 1
            $this->parameters[2],
70 1
            ['Boolean', 'Query', 'Reference', 'Bind']
71
        );
72 1
    }
73
74 1
    protected function normalizeRegexReplace(QueryBuilder $queryBuilder): void
75
    {
76 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...
77 1
            $this->parameters[0],
78 1
            ['Query', 'Reference', 'Bind']
79
        );
80
81 1
        $this->parameters[1] = $queryBuilder->normalizeArgument(
82 1
            $this->parameters[1],
83 1
            ['Query', 'Reference', 'Bind']
84
        );
85
86 1
        $this->parameters[2] = $queryBuilder->normalizeArgument(
87 1
            $this->parameters[2],
88 1
            ['Query', 'Reference', 'Bind']
89
        );
90
91 1
        $this->parameters[3] = $queryBuilder->normalizeArgument(
92 1
            $this->parameters[3],
93 1
            ['Boolean', 'Query', 'Reference', 'Bind']
94
        );
95 1
    }
96
97 1
    protected function normalizeRegexSplit(QueryBuilder $queryBuilder): void
98
    {
99 1
        $this->parameters['text'] = $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...
100 1
            $this->parameters['text'],
101 1
            ['Query', 'Reference', 'Bind']
102
        );
103
104 1
        $this->parameters['splitExpression'] = $queryBuilder->normalizeArgument(
105 1
            $this->parameters['splitExpression'],
106 1
            ['Query', 'Reference', 'Bind']
107
        );
108
109 1
        $this->parameters['caseInsensitive'] = $queryBuilder->normalizeArgument(
110 1
            $this->parameters['caseInsensitive'],
111 1
            ['Boolean', 'Query', 'Reference', 'Bind']
112
        );
113
114 1
        if (isset($this->parameters['limit'])) {
115 1
            $this->parameters['limit'] = $queryBuilder->normalizeArgument(
116 1
                $this->parameters['limit'],
117 1
                ['Number', 'Query', 'Reference', 'Bind']
118
            );
119
        }
120 1
    }
121
122 1
    protected function normalizeRegexTest(QueryBuilder $queryBuilder): void
123
    {
124 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...
125 1
            $this->parameters[0],
126 1
            ['Query', 'Reference', 'Bind']
127
        );
128
129 1
        $this->parameters[1] = $queryBuilder->normalizeArgument(
130 1
            $this->parameters[1],
131 1
            ['Query', 'Reference', 'Bind']
132
        );
133
134 1
        $this->parameters[2] = $queryBuilder->normalizeArgument(
135 1
            $this->parameters[2],
136 1
            ['Boolean', 'Query', 'Reference', 'Bind']
137
        );
138 1
    }
139
140 1
    protected function normalizeSplit(QueryBuilder $queryBuilder): void
141
    {
142 1
        $this->parameters['value'] = $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...
143 1
            $this->parameters['value'],
144 1
            ['Query', 'Reference', 'Bind']
145
        );
146
147 1
        $this->parameters['separator'] = $queryBuilder->normalizeArgument(
148 1
            $this->parameters['separator'],
149 1
            ['Query', 'Reference', 'Bind']
150
        );
151
152 1
        if (isset($this->parameters['limit'])) {
153 1
            $this->parameters['limit'] = $queryBuilder->normalizeArgument(
154 1
                $this->parameters['limit'],
155 1
                ['Number', 'Query', 'Reference', 'Bind']
156
            );
157
        }
158 1
    }
159
160 1
    protected function normalizeSubstitute(QueryBuilder $queryBuilder): void
161
    {
162 1
        $this->parameters['value'] = $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...
163 1
            $this->parameters['value'],
164 1
            ['Query', 'Reference', 'Bind']
165
        );
166
167 1
        $this->parameters['search'] = $queryBuilder->normalizeArgument(
168 1
            $this->parameters['search'],
169 1
            ['List', 'Reference', 'Bind']
170
        );
171
172 1
        $this->parameters['replace'] = $queryBuilder->normalizeArgument(
173 1
            $this->parameters['replace'],
174 1
            ['List', 'Query', 'Reference', 'Bind']
175
        );
176
177 1
        $this->parameters['limit'] = $queryBuilder->normalizeArgument(
178 1
            $this->parameters['limit'],
179 1
            ['Number', 'Query', 'Reference', 'Bind']
180
        );
181 1
    }
182
183 1
    protected function normalizeSubstring(QueryBuilder $queryBuilder): void
184
    {
185 1
        $this->parameters['value'] = $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...
186 1
            $this->parameters['value'],
187 1
            ['Query', 'Reference', 'Bind']
188
        );
189
190 1
         $this->parameters['offset'] = $queryBuilder->normalizeArgument(
191 1
             $this->parameters['offset'],
192 1
             ['Number', 'Query', 'Reference', 'Bind']
193
         );
194
195 1
         $this->parameters['length'] = $queryBuilder->normalizeArgument(
196 1
             $this->parameters['length'],
197 1
             ['Number', 'Query', 'Reference', 'Bind']
198
         );
199 1
    }
200
201 1
    protected function normalizeTokens(QueryBuilder $queryBuilder): void
202
    {
203 1
        $this->normalizeStrings($queryBuilder);
204 1
    }
205
206 1
    protected function normalizeTrim(QueryBuilder $queryBuilder): void
207
    {
208 1
        $this->parameters['value'] = $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...
209 1
            $this->parameters['value'],
210 1
            ['Query', 'Reference', 'Bind']
211
        );
212
213 1
        $this->parameters['type'] = $queryBuilder->normalizeArgument(
214 1
            $this->parameters['type'],
215 1
            ['Number', 'Query', 'Reference', 'Bind']
216
        );
217 1
    }
218
219 1
    protected function normalizeUpper(QueryBuilder $queryBuilder): void
220
    {
221 1
        $this->normalizeStrings($queryBuilder);
222 1
    }
223
}
224