Passed
Push — master ( f0a715...da0ac6 )
by Mike
02:11
created

KernelFacade::getService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace Xervice\Kernel;
5
6
7
use Xervice\Core\Facade\AbstractFacade;
8
use Xervice\Kernel\Business\Service\ServiceInterface;
9
10
/**
11
 * @method \Xervice\Kernel\KernelFactory getFactory()
12
 */
13
class KernelFacade extends AbstractFacade
14
{
15 1
    public function boot(): void
16
    {
17 1
        $this->getFactory()->getServiceProvider()->boot();
18 1
    }
19
20 1
    public function run(): void
21
    {
22 1
        $this->getFactory()->getServiceProvider()->execute();
23 1
    }
24
25
    /**
26
     * @param string $serviceName
27
     *
28
     * @return \Xervice\Kernel\Business\Service\ServiceInterface
29
     */
30
    public function getService(string $serviceName): ServiceInterface
31
    {
32
        return $this->getFactory()->getServiceProvider()->get($serviceName);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFactory...er()->get($serviceName) could return the type null which is incompatible with the type-hinted return Xervice\Kernel\Business\Service\ServiceInterface. Consider adding an additional type-check to rule them out.
Loading history...
33
    }
34
}
35