for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Stu\Module\Control\Component;
use Stu\Component\Game\ModuleEnum;
use Stu\Config\Init;
use Stu\Module\Control\ControllerInterface;
class ControllerDiscovery implements ControllerDiscoveryInterface
{
/**
* @return array<string, ControllerInterface>
*/
public function getControllers(ModuleEnum $module, bool $isViewController): array
$controllers = Init::getContainer()->get($this->getContainerIdentifier($module->name, $isViewController));
name
Stu\Component\Game\ModuleEnum
$commonModule = $module->getCommonModule();
if ($commonModule === null) {
return $controllers;
}
return array_merge(Init::getContainer()->get($this->getContainerIdentifier($commonModule, $isViewController)), $controllers);
private function getContainerIdentifier(string $module, bool $isViewController): string
return sprintf(
'%s_%s',
$module,
$isViewController ? 'VIEWS' : 'ACTIONS'
);