/** * * @return ModelDescription */ public function getDescription() { return Cache::read((new \ReflectionClass($this))->getName() . '::desc', function () { return new ModelDescription($this); }); }
private function getMethod($path) { $methods = kaikai\Cache::read("controller.{$this->getClassName()}.methods", function () { $class = new ReflectionClass($this); $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC); $results = []; foreach ($methods as $method) { $methodName = $method->getName(); if (substr($methodName, 0, 2) == '__') { continue; } if (array_search($methodName, ['addComponent', 'executeControllerAction', 'setComponentResolverParameters'])) { continue; } $docComments = $this->parseDocComment($method->getDocComment()); $keyName = isset($docComments['action']) ? $docComments['action'] . $docComments['method'] : $methodName; $results[$keyName] = ['name' => $method->getName(), 'binder' => isset($docComments['binder']) ? $docComments['binder'] : controllers\ModelBinderRegister::getDefaultBinderClass()]; } return $results; }); if (isset($methods[$path . utils\Input::server('REQUEST_METHOD')])) { return $methods[$path . utils\Input::server('REQUEST_METHOD')]; } else { if (isset($methods[$path])) { return $methods[$path]; } } return false; }