Passed
Push — master ( eb8cff...c3a046 )
by Caen
03:04 queued 14s
created

BaseSystemCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 6
c 3
b 0
f 0
dl 0
loc 21
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A boot() 0 3 1
A setKernel() 0 5 1
1
<?php
2
3
namespace Hyde\Framework\Foundation;
4
5
use Hyde\Framework\Contracts\HydeKernelContract;
6
use Illuminate\Support\Collection;
7
8
/**
9
 * @internal Base class for the system collections.
10
 *
11
 * @see \Hyde\Framework\Foundation\FileCollection
12
 * @see \Hyde\Framework\Foundation\PageCollection
13
 * @see \Hyde\Framework\Foundation\RouteCollection
14
 */
15
abstract class BaseSystemCollection extends Collection
16
{
17
    protected HydeKernelContract $kernel;
18
19
    abstract protected function runDiscovery(): self;
20
21
    public static function boot(HydeKernelContract $kernel): static
22
    {
23
        return (new static())->setKernel($kernel)->runDiscovery();
24
    }
25
26
    protected function __construct($items = [])
27
    {
28
        parent::__construct($items);
29
    }
30
31
    protected function setKernel(HydeKernelContract $kernel): static
32
    {
33
        $this->kernel = $kernel;
34
35
        return $this;
36
    }
37
}
38