17 private static $excludeds=[
"__construct",
"isValid",
"initialize",
"finalize",
"onInvalidControl",
"loadView",
"forward",
"redirectToRoute" ];
30 $ns=$config[
"mvcNS"][
"controllers"];
31 if ($ns !==
"" && $ns !== null) {
38 $url=\substr($url, 0, strlen($url) - 1);
39 $u=\explode(
"/", $url);
41 if (\class_exists($u[0])) {
42 $controllerClass=$u[0];
45 if (\method_exists($controllerClass, $u[1])) {
46 $method=new \ReflectionMethod($u[0], $u[1]);
47 $r=self::scanMethod($controllerClass, $method);
55 public static function init() {
62 }
catch ( \Exception $e ) {
66 foreach ( $files as $file ) {
69 if (isset($restCtrls[$controllerClass]) ===
false) {
70 $reflect=new \ReflectionClass($controllerClass);
71 if (!$reflect->isAbstract() && $reflect->isSubclassOf(
"Ubiquity\controllers\Controller") && ! $reflect->isSubclassOf(
"Ubiquity\controllers\seo\SeoController")) {
72 $methods=$reflect->getMethods(\ReflectionMethod::IS_PUBLIC);
73 foreach ( $methods as $method ) {
74 $r=self::scanMethod($controllerClass, $method);
85 private static function scanMethod($controllerClass, \ReflectionMethod $method) {
87 if (\array_search($method->name, self::$excludeds) ===
false && !
UString::startswith($method->name,
"_")) {
92 if ($param->isOptional() && !$param->isVariadic()) {
93 $defaults[$param->name]=$param->getDefaultValue();
147 $reflect=new \ReflectionClass($this->controller);
static getClassFullNameFromFile($filePathName)
get the full name (name \ namespace) of a class from its file path result example: (string) "I\Am\The...
static initWithPath($url)
static scanMethod($controllerClass, \ReflectionMethod $method)
static getAnnotations($controllerName, $actionName)
__construct($controller="", $action="", $parameters=[], $dValues=[], $annots=[])
setController($controller)
setParameters($parameters)
static getControllersFiles(&$config, $silent=false)
static endswith($hay, $needle)
static startswith($hay, $needle)