public static function readCTL() { $routes = array(); $parse = new Parser(); foreach (self::allCTL() as $className) { $parse->analyze($className); } $parse->setAllowInherited(true); //$parse->setMethodFilter(ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED); $classes = $parse->getClasses(); foreach ($classes as $class) { // is web restful if (!$class->hasAnnotation("Restful")) { continue; } // is has uri annotation $classUriAnns = $class->getAnnotations("uri"); if (empty($classUriAnns)) { $classUri = ""; } else { $classUri = $classUriAnns[0]->getValue(); } $className = $class->getName(); $methods = $class->getMethods(); foreach ($methods as $method) { $HttpMethods = array(); if ($method->hasAnnotation('GET')) { $HttpMethods[] = 'GET'; } if ($method->hasAnnotation('POST')) { $HttpMethods[] = 'POST'; } if ($method->hasAnnotation('PUT')) { $HttpMethods[] = 'PUT'; } if ($method->hasAnnotation('DELETE')) { $HttpMethods[] = 'DELETE'; } $uriParamAnns = $method->getAnnotations("uri"); if (count($uriParamAnns) == 0) { $uri = $classUri; } else { $uri = $classUri . $uriParamAnns[0]->getValue(); } $route = array('controller' => $className, 'action' => $method->getName(), 'methods' => $HttpMethods, 'uri' => $uri); $routes[] = $route; } } return $routes; }