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

BelongsToParentsTree   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 6
c 1
b 0
f 1
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getQueryForTree() 0 6 1
A getOperator() 0 3 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