Failed Conditions
Pull Request — master (#59)
by Dallas
13:19
created

BelongsToParentsTree::getQueryForTree()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\LTree\Relations;
6
7
use Illuminate\Database\Eloquent\Builder;
8
use Umbrellio\LTree\Traits\LTreeModelTrait;
9
10
class BelongsToParentsTree extends AbstractBelongsToTree
11
{
12
    /**
13
     * @param Builder|LTreeModelTrait $model
14
     */
15 2
    protected function getQueryForTree($model): Builder
16
    {
17
        return $model
18 2
            ->newQuery()
0 ignored issues
show
Bug introduced by
The method newQuery() does not exist on Illuminate\Database\Eloquent\Builder. ( Ignorable by Annotation )

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

18
            ->/** @scrutinizer ignore-call */ newQuery()

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...
19 2
            ->ancestorsOf($model)
20 2
            ->orderBy($this->getLTreeRelated()->getLtreePathColumn());
21
    }
22
23 2
    protected function getOperator(): string
24
    {
25 2
        return '@>';
26
    }
27
}
28