/** * In phalcon, the availability of parameters in MICRO * applications events is not the same as the availability in regular * applications. * We have no easy way to access the controller name in the * beforeExecute event. * This is a hack that allows us to extract it, so we know which * controller class we are dispatching to. * @return strin|null **/ private function extractDispatchInformation(Micro $app) { $controllerName = null; $actionName = null; $handler = $app->getActiveHandler(); if (isset($handler[0]) && $handler[0] instanceof \Phalcon\Mvc\Micro\LazyLoader) { $reflector = new \ReflectionProperty($handler[0], '_definition'); $reflector->setAccessible(true); $controllerName = $reflector->getValue($handler[0]); } if (isset($handler[1])) { $actionName = $handler[1]; } return [$controllerName, $actionName]; }