/** * @param ContainerInterface $container * @param $requestedName * @param array $options * @return ActionHandlesListener */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { /* @var $moduleOptions ModuleOptions */ $moduleOptions = $container->get(ModuleOptions::class); $updater = $container->get(LayoutUpdaterInterface::class); $actionHandlesListener = new ActionHandlesListener(); $actionHandlesListener->setUpdater($updater); $actionHandlesListener->setControllerMap($moduleOptions->getControllerMap()); $actionHandlesListener->setPreferRouteMatchController($moduleOptions->isPreferRouteMatchController()); return $actionHandlesListener; }
/** * * @param ServiceLocatorInterface $serviceLocator * @return ActionHandlesListener */ public function createService(ServiceLocatorInterface $serviceLocator) { /* @var $moduleOptions ModuleOptions */ $moduleOptions = $serviceLocator->get('ConLayout\\Options\\ModuleOptions'); $updater = $serviceLocator->get('ConLayout\\Updater\\LayoutUpdaterInterface'); $actionHandlesListener = new ActionHandlesListener(); $actionHandlesListener->setUpdater($updater); $actionHandlesListener->setControllerMap($moduleOptions->getControllerMap()); $actionHandlesListener->setPreferRouteMatchController($moduleOptions->isPreferRouteMatchController()); return $actionHandlesListener; }
public function testGetterAndSetters() { $updater = new LayoutUpdater(); $this->listener->setUpdater($updater); $this->assertEquals($updater, $this->listener->getUpdater()); $controllerMap = ['Some/Name' => true, 'Other/Name' => 'string']; $this->listener->setControllerMap($controllerMap); $this->assertEquals($controllerMap, $this->listener->getControllerMap()); $preferRouteMatchController = true; $this->listener->setPreferRouteMatchController($preferRouteMatchController); $this->assertEquals($preferRouteMatchController, $this->listener->isPreferRouteMatchController()); }