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

ControllerDiscovery::getContainerIdentifier()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
ccs 0
cts 5
cp 0
crap 6
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