Passed
Push — next ( ee2197...d54041 )
by Bas
02:37
created

NormalizesArrayFunctions   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 29
c 1
b 0
f 0
dl 0
loc 78
ccs 47
cts 47
cp 1
rs 10
wmc 11

10 Methods

Rating   Name   Duplication   Size   Complexity  
A normalizeLast() 0 3 1
A normalizeCountDistinct() 0 3 1
A normalizeFirst() 0 3 1
A normalizeShift() 0 5 1
A normalizeLength() 0 3 1
A normalizeAppend() 0 16 2
A normalizeFlatten() 0 10 1
A normalizeUnion() 0 3 1
A normalizeUnique() 0 5 1
A normalizeUnionDistinct() 0 3 1
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 NormalizesArrayFunctions
15
{
16 2
    protected function normalizeAppend(QueryBuilder $queryBuilder): void
17
    {
18 2
        $this->parameters['array'] = $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 2
            $this->parameters['array'],
20 2
            ['List', 'Query', 'Variable', 'Reference', 'Bind']
21
        );
22
23 2
        $this->parameters['values'] = $queryBuilder->normalizeArgument(
24 2
            $this->parameters['values'],
25 2
            ['List', 'Number', 'Query', 'Variable', 'Reference', 'Bind']
26
        );
27
28 2
        if (isset($this->parameters['unique'])) {
29 1
            $this->parameters['unique'] = $queryBuilder->normalizeArgument(
30 1
                $this->parameters['unique'],
31 1
                ['Boolean', 'Query', 'Variable', 'Reference', 'Bind']
32
            );
33
        }
34 2
    }
35
36 1
    protected function normalizeCountDistinct(QueryBuilder $queryBuilder): void
37
    {
38 1
        $this->normalizeArrays($queryBuilder);
0 ignored issues
show
Bug introduced by
The method normalizeArrays() does not exist on LaravelFreelancerNL\Flue...ormalizesArrayFunctions. Did you maybe mean normalizeLast()? ( Ignorable by Annotation )

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

38
        $this->/** @scrutinizer ignore-call */ 
39
               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...
39 1
    }
40
41 2
    protected function normalizeFirst(QueryBuilder $queryBuilder): void
42
    {
43 2
        $this->normalizeArrays($queryBuilder);
44 2
    }
45
46 1
    protected function normalizeFlatten(QueryBuilder $queryBuilder): void
47
    {
48 1
        $this->parameters['array'] = $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...
49 1
            $this->parameters['array'],
50 1
            ['List', 'Query', 'Variable', 'Reference', 'Bind']
51
        );
52
53 1
        $this->parameters['depth'] = $queryBuilder->normalizeArgument(
54 1
            $this->parameters['depth'],
55 1
            ['Number', 'Query', 'Reference', 'Bind']
56
        );
57 1
    }
58
59 1
    protected function normalizeLast(QueryBuilder $queryBuilder): void
60
    {
61 1
        $this->normalizeArrays($queryBuilder);
62 1
    }
63
64 2
    protected function normalizeLength(QueryBuilder $queryBuilder): void
65
    {
66 2
        $this->normalizeArrays($queryBuilder);
67 2
    }
68
69 1
    protected function normalizeShift(QueryBuilder $queryBuilder): void
70
    {
71 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...
72 1
            $this->parameters[0],
73 1
            ['List', 'Query', 'Variable', 'Reference', 'Bind']
74
        );
75 1
    }
76
77 1
    protected function normalizeUnion(QueryBuilder $queryBuilder): void
78
    {
79 1
        $this->normalizeArrays($queryBuilder);
80 1
    }
81
82 1
    protected function normalizeUnionDistinct(QueryBuilder $queryBuilder): void
83
    {
84 1
        $this->normalizeArrays($queryBuilder);
85 1
    }
86
87 1
    protected function normalizeUnique(QueryBuilder $queryBuilder): void
88
    {
89 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...
90 1
            $this->parameters[0],
91 1
            ['List', 'Query', 'Variable', 'Reference', 'Bind']
92
        );
93 1
    }
94
}
95