BelongsToDescendantsTree::getOperator()   A
last analyzed

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 0
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 Illuminate\Database\Eloquent\Model;
9
use Umbrellio\LTree\Interfaces\LTreeModelInterface;
10
use Umbrellio\LTree\Traits\LTreeModelTrait;
11
12
class BelongsToDescendantsTree extends AbstractBelongsToTree
13
{
14
    /**
15
     * @param Builder|LTreeModelTrait|Model $query
16
     * @param Model|LTreeModelInterface $model
17
     */
18 1
    protected function modifyQuery($query, Model $model): Builder
19
    {
20 1
        return $query->descendantsOf($model);
0 ignored issues
show
Bug introduced by
It seems like descendantsOf() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

20
        return $query->/** @scrutinizer ignore-call */ descendantsOf($model);
Loading history...
Bug introduced by
The method descendantsOf() 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

20
        return $query->/** @scrutinizer ignore-call */ descendantsOf($model);

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...
21
    }
22
23 1
    protected function getOperator(): string
24
    {
25 1
        return '<@';
26
    }
27
}
28