Passed
Push — dev ( 374f50...1bdd7d )
by Janko
15:55 queued 25s
created

ControllerDiscovery::getControllers()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Stu\Module\Control;
4
5
use Stu\Component\Game\ModuleViewEnum;
6
use Stu\Config\Init;
7
8
class ControllerDiscovery
9
{
10
    /**
11
     * @return array<string, ControllerInterface>
12
     */
13
    public function getControllers(ModuleViewEnum $module, bool $isViewController): array
14
    {
15
        return Init::getContainer()->get($this->getContainerIdentifier($module, $isViewController));
16
    }
17
18
    private function getContainerIdentifier(ModuleViewEnum $module, bool $isViewController): string
19
    {
20
        return sprintf(
21
            '%s_%s',
22
            $module->name,
0 ignored issues
show
Bug introduced by
The property name does not seem to exist on Stu\Component\Game\ModuleViewEnum.
Loading history...
23
            $isViewController ? 'VIEWS' : 'ACTIONS'
24
        );
25
    }
26
}
27