You are here

public static function JsonSubrequestDenormalizer::getMethodFromAction in Subrequests 8

Same name and namespace in other branches
  1. 8.2 src/Normalizer/JsonSubrequestDenormalizer.php \Drupal\subrequests\Normalizer\JsonSubrequestDenormalizer::getMethodFromAction()
  2. 3.x src/Normalizer/JsonSubrequestDenormalizer.php \Drupal\subrequests\Normalizer\JsonSubrequestDenormalizer::getMethodFromAction()

Gets the HTTP method from the list of allowed actions.

Parameters

string $action: The action name.

Return value

string The HTTP method.

1 call to JsonSubrequestDenormalizer::getMethodFromAction()
JsonSubrequestDenormalizer::denormalize in src/Normalizer/JsonSubrequestDenormalizer.php
Denormalizes data back into an object of the given class.

File

src/Normalizer/JsonSubrequestDenormalizer.php, line 102

Class

JsonSubrequestDenormalizer

Namespace

Drupal\subrequests\Normalizer

Code

public static function getMethodFromAction($action) {
  switch ($action) {
    case 'create':
      return Request::METHOD_POST;
    case 'update':
      return Request::METHOD_PATCH;
    case 'replace':
      return Request::METHOD_PUT;
    case 'delete':
      return Request::METHOD_DELETE;
    case 'exists':
      return Request::METHOD_HEAD;
    case 'discover':
      return Request::METHOD_OPTIONS;
    default:
      return Request::METHOD_GET;
  }
}