/** * {@inheritDoc} */ public function loadActions() { $actions = new ActionCollection(); foreach ($this->classes as $id => $class) { $reflection = Reflection::loadClassReflection($class); // Get all methods from class $methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($methods as $method) { $methodAnnotations = $this->reader->getMethodAnnotations($method); foreach ($methodAnnotations as $annotation) { if ($annotation instanceof ActionAnnotation) { if ($method->isStatic()) { throw new \RuntimeException('The static method not supported (@todo).'); } if ($annotation->response) { $response = new ObjectResponse($annotation->response->class); } else { $response = null; } $action = new ServiceAction($annotation->name, $id, $method->getName(), $annotation->validationGroups, $annotation->securityGroups, $annotation->requestMappingGroup, $annotation->useStrictValidation, $annotation->checkEnabled, $response); $actions->addAction($action); } } } } return $actions; }
/** * {@inheritDoc} */ public function loadActions() { $actions = new ActionCollection(); foreach ($this->actions as $actionName => $actionInfo) { $action = new ServiceAction($actionName, $actionInfo['service'], $actionInfo['method']); $actions->addAction($action); } return $actions; }
/** * Get all actions * * @return \FivePercent\Component\Api\SMD\Action\ActionCollectionInterface */ public function loadActions() { $actions = new ActionCollection(); foreach ($this->loaders as $loader) { $childActions = $loader->loadActions(); $actions->addActions($childActions); } return $actions; }