* @deprecated use \oat\tao\model\routing\RouteAnnotationService instead */ class ActionDescription { private static $registered = false; /** * The method implementing the action * * @var ReflectionMethod */ private $method; /** * Create a new lazy parsing action description * * @param ReflectionMethod $method */ public function __construct(ReflectionMethod $method) { $this->method = $method; } /** * * @return \phpDocumentor\Reflection\DocBlock */ protected function getDocBlock() { if (!self::$registered) { Tag::registerTagHandler('requiresRight', '\oat\tao\model\controllerMap\RequiresRightTag'); self::$registered = true; } return new DocBlock($this->method); } /** * Get the name of the action, which corresponds * to the name of the called function * * @return string */ public function getName() { return $this->method->getName(); } /** * Get a human readable description of what the action does * * @return string */ public function getDescription() { return $this->getDocBlock()->getShortDescription(); } /** * Returns an array of all rights required to execute the action * * The array uses the name of the parmeter as key and the value is * a string identifying the right * * @return string */ public function getRequiredRights() { $privileges = []; foreach ($this->getDocBlock()->getTagsByName('requiresRight') as $tag) { $privileges[$tag->getParameterName()] = $tag->getRightId(); } return $privileges; } }