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

ControllerDiscovery   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 7
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainerIdentifier() 0 6 2
A getControllers() 0 3 1
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