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

ManagesHydeKernel   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 29
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getBasePath() 0 3 1
A setBasePath() 0 3 1
A boot() 0 7 1
A getInstance() 0 3 1
A setInstance() 0 3 1
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