*/ class ControllerDescription { private static $BLACK_LIST = ['forward', 'redirect', 'forwardUrl', 'setView']; /** * Reflection of the controller * * @var ReflectionClass */ private $class; /** * Create a new lazy parsing controller description * * @param ReflectionClass $controllerClass */ public function __construct(ReflectionClass $controllerClass) { $this->class = $controllerClass; } /** * Returns the class name of the controller * * @return string */ public function getClassName() { return $this->class->getName(); } /** * Returns ann array of ActionDescription objects * * @return array */ public function getActions() { $actions = []; foreach ($this->class->getMethods(ReflectionMethod::IS_PUBLIC) as $m) { if ($m->isConstructor() || $m->isDestructor() || in_array($m->name, self::$BLACK_LIST)) { continue; } if (is_subclass_of($m->class, 'Module') || is_subclass_of($m->class, Controller::class)) { $actions[] = new ActionDescription($m); } } return $actions; } }