Passed
Push — master ( 604c70...f4f5f5 )
by Caen
03:01 queued 12s
created

ManagesHydeKernel::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Foundation\Concerns;
6
7
use Hyde\Foundation\FileCollection;
8
use Hyde\Foundation\HydeKernel;
9
use Hyde\Foundation\PageCollection;
10
use Hyde\Foundation\RouteCollection;
11
12
/**
13
 * @internal Single-use trait for the HydeKernel class.
14
 *
15
 * @see \Hyde\Foundation\HydeKernel
16
 */
17
trait ManagesHydeKernel
18
{
19
    public function boot(): void
20
    {
21
        $this->booted = true;
0 ignored issues
show
Bug Best Practice introduced by
The property booted does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
22
23
        $this->files = FileCollection::boot($this);
0 ignored issues
show
Bug Best Practice introduced by
The property files does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
24
        $this->pages = PageCollection::boot($this);
0 ignored issues
show
Bug Best Practice introduced by
The property pages does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
25
        $this->routes = RouteCollection::boot($this);
0 ignored issues
show
Bug Best Practice introduced by
The property routes does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
26
    }
27
28
    public static function getInstance(): HydeKernel
29
    {
30
        return static::$instance;
31
    }
32
33
    public static function setInstance(HydeKernel $instance): void
34
    {
35
        static::$instance = $instance;
0 ignored issues
show
Bug Best Practice introduced by
The property instance does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
36
    }
37
38
    public function setBasePath(string $basePath): void
39
    {
40
        $this->basePath = rtrim($basePath, '/\\');
0 ignored issues
show
Bug Best Practice introduced by
The property basePath does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
41
    }
42
43
    public function getBasePath(): string
44
    {
45
        return $this->basePath;
46
    }
47
48
    public function setSourceRoot(string $sourceRoot): void
49
    {
50
        $this->sourceRoot = rtrim($sourceRoot, '/\\');
0 ignored issues
show
Bug Best Practice introduced by
The property sourceRoot does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
51
    }
52
53
    public function getSourceRoot(): string
54
    {
55
        return $this->sourceRoot;
56
    }
57
}
58