NormalizesDocumentFunctions::normalizeMatches()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 9
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 15
ccs 10
cts 10
cp 1
crap 1
rs 9.9666
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 NormalizesDocumentFunctions
15
{
16
    abstract protected function normalizeNumbers(QueryBuilder $queryBuilder);
17
18 1
    protected function normalizeAttributes(QueryBuilder $queryBuilder): void
19
    {
20 1
        $this->parameters['document'] = $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...
21 1
            $this->parameters['document'],
22 1
            ['Object', 'Query', 'Variable', 'Reference', 'Bind']
23
        );
24
25 1
        $this->parameters['removeInternal'] = $queryBuilder->normalizeArgument(
26 1
            $this->parameters['removeInternal'],
27 1
            ['Boolean', 'Query', 'Reference', 'Bind']
28
        );
29
30 1
        $this->parameters['sort'] = $queryBuilder->normalizeArgument(
31 1
            $this->parameters['sort'],
32 1
            ['Boolean', 'Query', 'Reference', 'Bind']
33
        );
34
    }
35
36 2
    protected function normalizeKeep(QueryBuilder $queryBuilder): void
37
    {
38 2
        $this->parameters['document'] = $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 2
            $this->parameters['document'],
40 2
            ['Object', 'Query', 'Variable', 'Reference', 'Bind']
41
        );
42
43 2
        $this->parameters['attributes'] = $queryBuilder->normalizeArgument(
44 2
            $this->parameters['attributes'],
45 2
            ['List', 'Query', 'Variable', 'Reference', 'Bind']
46
        );
47
    }
48
49 1
    protected function normalizeMatches(QueryBuilder $queryBuilder): void
50
    {
51 1
        $this->parameters['document'] = $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['document'],
53 1
            ['Object', 'Query', 'Variable', 'Reference', 'Bind']
54
        );
55
56 1
        $this->parameters['examples'] = $queryBuilder->normalizeArgument(
57 1
            $this->parameters['examples'],
58 1
            ['List', 'Object', 'Query', 'Variable', 'Reference', 'Bind']
59
        );
60
61 1
        $this->parameters['returnIndex'] = $queryBuilder->normalizeArgument(
62 1
            $this->parameters['returnIndex'],
63 1
            ['Boolean', 'Query', 'Variable', 'Reference', 'Bind']
64
        );
65
    }
66
67 3
    protected function normalizeMerge(QueryBuilder $queryBuilder): void
68
    {
69 3
        $this->normalizeDocuments($queryBuilder);
0 ignored issues
show
Bug introduced by
The method normalizeDocuments() does not exist on LaravelFreelancerNL\Flue...alizesDocumentFunctions. Did you maybe mean normalizeNumbers()? ( Ignorable by Annotation )

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

69
        $this->/** @scrutinizer ignore-call */ 
70
               normalizeDocuments($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...
70
    }
71
72 1
    protected function normalizeParseIdentifier(QueryBuilder $queryBuilder): void
73
    {
74 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...
75 1
            $this->parameters[0],
76 1
            ['Query', 'Variable', 'Reference', 'Bind']
77
        );
78
    }
79
80 2
    protected function normalizeUnset(QueryBuilder $queryBuilder): void
81
    {
82 2
        $this->parameters['document'] = $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...
83 2
            $this->parameters['document'],
84 2
            ['Object', 'Query', 'Variable', 'Reference', 'Bind']
85
        );
86
87 2
        $this->parameters['attributes'] = $queryBuilder->normalizeArgument(
88 2
            $this->parameters['attributes'],
89 2
            ['List', 'Query', 'Variable', 'Reference', 'Bind']
90
        );
91
    }
92
}
93