private function validateMethod($method)
{
if (null === $method) {
return;
}
if (!is_string($method)) {
throw new InvalidArgumentException(sprintf('Unsupported HTTP method; must be a string, received %s', is_object($method) ? get_class($method) : gettype($method)));
}
if (!preg_match('/^[!#$%&\'*+.^_`\\|~0-9a-z-]+$/i', $method)) {
throw new InvalidArgumentException(sprintf('Unsupported HTTP method "%s" provided', $method));
}
}