OrdersByPath   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A compileOrderByPath() 0 5 1
A __construct() 0 3 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