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

ManagesHydeKernel::getInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Hyde\Framework\Foundation\Concerns;
4
5
use Hyde\Framework\Foundation\FileCollection;
6
use Hyde\Framework\Foundation\PageCollection;
7
use Hyde\Framework\Foundation\RouteCollection;
8
use Hyde\Framework\HydeKernel;
9
10
/**
11
 * @internal Single-use trait for the HydeKernel class.
12
 *
13
 * @see \Hyde\Framework\HydeKernel
14
 */
15
trait ManagesHydeKernel
16
{
17
    public function boot(): void
18
    {
19
        $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...
20
21
        $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...
22
        $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...
23
        $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...
24
    }
25
26
    public static function getInstance(): HydeKernel
27
    {
28
        return static::$instance;
29
    }
30
31
    public static function setInstance(HydeKernel $instance): void
32
    {
33
        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...
34
    }
35
36
    public function setBasePath(string $basePath): void
37
    {
38
        $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...
39
    }
40
41
    public function getBasePath(): string
42
    {
43
        return $this->basePath;
44
    }
45
}
46