Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
HandlesFoundationCollections
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
4 / 4
5
100.00% covered (success)
100.00%
1 / 1
 files
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 pages
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 routes
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 needsToBeBooted
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Hyde\Foundation\Concerns;
6
7use Hyde\Foundation\Kernel\FileCollection;
8use Hyde\Foundation\Kernel\PageCollection;
9use Hyde\Foundation\Kernel\RouteCollection;
10
11/**
12 * @internal Single-use trait for the HydeKernel class.
13 *
14 * @see \Hyde\Foundation\HydeKernel
15 */
16trait HandlesFoundationCollections
17{
18    public function files(): FileCollection
19    {
20        $this->needsToBeBooted();
21
22        return $this->files;
23    }
24
25    public function pages(): PageCollection
26    {
27        $this->needsToBeBooted();
28
29        return $this->pages;
30    }
31
32    public function routes(): RouteCollection
33    {
34        $this->needsToBeBooted();
35
36        return $this->routes;
37    }
38
39    protected function needsToBeBooted(): void
40    {
41        if (! $this->booted) {
42            $this->boot();
43        }
44    }
45}