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

BaseSystemCollection::setKernel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
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