mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 16:29:29 +00:00
Added missing HttpMethod enum
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainers\Container;
|
||||
|
||||
enum HttpMethod: string
|
||||
{
|
||||
case GET = 'GET';
|
||||
case POST = 'POST';
|
||||
case PUT = 'PUT';
|
||||
case DELETE = 'DELETE';
|
||||
case HEAD = 'HEAD';
|
||||
case OPTIONS = 'OPTIONS';
|
||||
|
||||
public static function fromString(string $method): self
|
||||
{
|
||||
return match (strtoupper($method)) {
|
||||
'GET' => self::GET,
|
||||
'POST' => self::POST,
|
||||
'PUT' => self::PUT,
|
||||
'DELETE' => self::DELETE,
|
||||
'HEAD' => self::HEAD,
|
||||
'OPTIONS' => self::OPTIONS,
|
||||
default => throw new \InvalidArgumentException("Invalid HTTP method: $method"),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user