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

HandlesFoundationCollections::pages()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
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
9
/**
10
 * @internal Single-use trait for the HydeKernel class.
11
 *
12
 * @see \Hyde\Framework\HydeKernel
13
 */
14
trait HandlesFoundationCollections
15
{
16
    public function files(): FileCollection
17
    {
18
        $this->needsToBeBooted();
19
20
        return $this->files;
21
    }
22
23
    public function pages(): PageCollection
24
    {
25
        $this->needsToBeBooted();
26
27
        return $this->pages;
28
    }
29
30
    public function routes(): RouteCollection
31
    {
32
        $this->needsToBeBooted();
33
34
        return $this->routes;
35
    }
36
37
    protected function needsToBeBooted(): void
38
    {
39
        if (! $this->booted) {
40
            $this->boot();
0 ignored issues
show
Bug introduced by
It seems like boot() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
            $this->/** @scrutinizer ignore-call */ 
41
                   boot();
Loading history...
41
        }
42
    }
43
}
44