getVerbs() public method

Get an array of verbs that are allowed on this route
public getVerbs ( ) : array
return array
Beispiel #1
0
 /**
  * Ensure our method is in out list of allowed verbs
  * @param $httpMethod
  * @return bool
  */
 protected function methodIsInOurListOfAllowedVerbs($httpMethod)
 {
     if (!in_array($httpMethod, $this->routeMetaData->getVerbs())) {
         return false;
     }
     return true;
 }
Beispiel #2
0
 /**
  * Gets an instance of the "default" action based of request information
  * @throws DrestException
  * @return AbstractAction $action
  */
 protected function getDefaultAction()
 {
     $httpMethod = $this->dm->calledWithANamedRoute() ? array_slice($this->matched_route->getVerbs(), 0, 1)[0] : $this->getRequest()->getHttpMethod();
     $className = '\\Drest\\Service\\Action\\' . ucfirst(strtolower($httpMethod));
     switch ($httpMethod) {
         case Request::METHOD_GET:
         case Request::METHOD_DELETE:
             $className .= $this->matched_route->isCollection() ? 'Collection' : 'Element';
             break;
         default:
             $className .= 'Element';
             break;
     }
     if (!class_exists($className)) {
         throw DrestException::unknownActionClass($className);
     }
     return new $className($this);
 }