Ancestors   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 7
c 1
b 0
f 0
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A limit() 0 9 2
1
<?php
2
3
namespace Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations;
4
5
use Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations\Traits\HasEagerLimit;
6
use Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\Ancestors as Base;
7
8
class Ancestors extends Base
9
{
10
    use HasEagerLimit;
0 ignored issues
show
Bug introduced by
The trait Staudenmeir\EloquentEage...ns\Traits\HasEagerLimit requires the property $exists which is not provided by Staudenmeir\EloquentEage...ent\Relations\Ancestors.
Loading history...
11
12
    /**
13
     * Set the "limit" value of the query.
14
     *
15
     * @param int $value
16
     * @return $this
17
     */
18 20
    public function limit($value)
19
    {
20 20
        if ($this->parent->exists) {
21 4
            $this->query->limit($value);
22
        } else {
23 16
            $this->addGroupLimit($value);
24
        }
25
26 20
        return $this;
27
    }
28
}
29