Passed
Push — next ( 64a7ed...91e38a )
by Bas
03:25 queued 12s
created

CompilesGroups::compileHavings()   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 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace LaravelFreelancerNL\Aranguent\Query\Concerns;
4
5
use LaravelFreelancerNL\Aranguent\Query\Builder;
6
7
trait CompilesGroups
8
{
9
    /**
10
     * Compile the "group by" portions of the query.
11
     *
12
     * @param Builder $builder
13
     * @param string[]  $groups
14
     * @return Builder
15
     */
16 5
    protected function compileGroups(Builder $builder, array $groups)
17
    {
18 5
        $aqlGroups = [];
19 5
        foreach ($groups as $key => $group) {
20 5
            $aqlGroups[$key][0] = $group;
21 5
            $aqlGroups[$key][1] = 'characterDoc.' . $group;
22
        }
23
24 5
        $builder->aqb = $builder->aqb->collect($aqlGroups);
25
26 5
        return $builder;
27
    }
28
    /**
29
     * Compile the "group by" portions of the query.
30
     *
31
     * @param Builder $builder
32
     * @param string[]  $groups
33
     * @return Builder
34
     */
35 3
    protected function compileHavings(Builder $builder, array $havings)
36
    {
37 3
        return $this->compileWheres($builder, $havings, 'havings');
0 ignored issues
show
Bug introduced by
The method compileWheres() does not exist on LaravelFreelancerNL\Aran...Concerns\CompilesGroups. Did you maybe mean compileGroups()? ( Ignorable by Annotation )

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

37
        return $this->/** @scrutinizer ignore-call */ compileWheres($builder, $havings, 'havings');

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
    }
39
}
40