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

normalizeFirstDocument()   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 NormalizesMiscellaneousFunctions
15
{
16 1
    protected function normalizeDocument(QueryBuilder $queryBuilder): void
17
    {
18 1
        if ($this->parameters['id']  === null) {
19 1
            $this->parameters['id']  = $this->parameters['collection'];
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...
20 1
            unset($this->parameters['collection']);
21
        }
22
23 1
        if (isset($this->parameters['collection'])) {
24 1
            $this->parameters['collection'] = $queryBuilder->normalizeArgument(
25 1
                $this->parameters['collection'],
26 1
                ['Collection', 'Id', 'Query', 'Bind']
27
            );
28
        }
29 1
        $this->parameters['id'] = $queryBuilder->normalizeArgument(
30 1
            $this->parameters['id'],
31 1
            ['Id', 'Key', 'Query', 'List', 'Bind']
32
        );
33 1
    }
34
35 1
    protected function normalizeFirstDocument(QueryBuilder $queryBuilder): void
36
    {
37 1
        $this->normalizeAny($queryBuilder);
0 ignored issues
show
Bug introduced by
The method normalizeAny() does not exist on LaravelFreelancerNL\Flue...sMiscellaneousFunctions. Did you maybe mean normalizeDocument()? ( Ignorable by Annotation )

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

37
        $this->/** @scrutinizer ignore-call */ 
38
               normalizeAny($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...
38 1
    }
39
}
40