Passed
Push — master ( 9bbf4f...edf6a5 )
by Caen
02:59 queued 12s
created

BaseFoundationCollection::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Hyde\Framework\Foundation\Concerns;
4
5
use Hyde\Framework\HydeKernel;
6
use Illuminate\Support\Collection;
7
8
/**
9
 * @internal Base class for the kernel auto-discovery collections.
10
 *
11
 * @see \Hyde\Framework\Foundation\FileCollection
12
 * @see \Hyde\Framework\Foundation\PageCollection
13
 * @see \Hyde\Framework\Foundation\RouteCollection
14
 */
15
abstract class BaseFoundationCollection extends Collection
16
{
17
    protected HydeKernel $kernel;
18
19
    abstract protected function runDiscovery(): self;
20
21
    public static function boot(HydeKernel $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(HydeKernel $kernel): static
32
    {
33
        $this->kernel = $kernel;
34
35
        return $this;
36
    }
37
}
38