protected RestResourceConfig::normalizeRestMethod($method)
Normalizes the method to upper case and check validity.
Parameters
string $method: The request method.
Return value
string The normalised request method.
Throws
\InvalidArgumentException If the method is not supported.
File
- core/modules/rest/src/Entity/RestResourceConfig.php, line 257
Class
- RestResourceConfig
- Defines a RestResourceConfig configuration entity class.
Namespace
Drupal\rest\Entity
Code
protected function normalizeRestMethod($method) { $valid_methods = ['GET', 'POST', 'PATCH', 'DELETE']; $normalised_method = strtoupper($method); if (!in_array($normalised_method, $valid_methods)) { throw new \InvalidArgumentException('The method is not supported.'); } return $normalised_method; }
Please login to continue.