OrdersByPath::compileOrderByPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Staudenmeir\LaravelAdjacencyList\Query\Grammars;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
trait OrdersByPath
8
{
9
    protected $model;
10
11 1119
    public function __construct(Model $model)
12
    {
13 1119
        $this->model = $model;
14
    }
15
16
    /**
17
     * Compile an "order by path" clause.
18
     *
19
     * @return string
20
     */
21 13
    public function compileOrderByPath()
22
    {
23 13
        $path = $this->model->getPathName();
24
25 13
        return $this->wrap($path) . ' asc';
0 ignored issues
show
Bug introduced by
It seems like wrap() 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

25
        return $this->/** @scrutinizer ignore-call */ wrap($path) . ' asc';
Loading history...
26
    }
27
}
28