LTreeResourceCollection   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
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 14
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\LTree\Resources;
6
7
use Illuminate\Http\Resources\Json\ResourceCollection;
8
use Illuminate\Support\Collection;
9
use Umbrellio\LTree\Collections\LTreeCollection;
10
11
abstract class LTreeResourceCollection extends ResourceCollection
12
{
13
    /**
14
     * @param LTreeCollection|Collection $resource
15
     */
16 1
    public function __construct($resource, $sort = null, bool $usingSort = true, bool $loadMissing = true)
17
    {
18 1
        $collection = $resource->toTree($usingSort, $loadMissing);
19
20 1
        if ($sort) {
21 1
            $collection->sortTree($sort);
22
        }
23
24 1
        parent::__construct($collection->getChildren());
25
    }
26
}
27