/** * Returns all available actions of the specified controller. * @param Controller $controller the controller instance * @return array all available action IDs. */ public function getActions($controller) { $actions = array_keys($controller->actions()); $class = new \ReflectionClass($controller); foreach ($class->getMethods() as $method) { $name = $method->getName(); if ($name !== 'actions' && $method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0) { $actions[] = Inflector::camel2id(substr($name, 6), '-', true); } } sort($actions); return array_unique($actions); }