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

CompilesGroups   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 31
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A compileGroups() 0 11 2
A compileHavings() 0 3 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