1 | <?php |
||
21 | class Method |
||
22 | { |
||
23 | public const POST = 'POST'; |
||
24 | public const PUT = 'PUT'; |
||
25 | public const PATCH = 'PATCH'; |
||
26 | public const DELETE = 'DELETE'; |
||
27 | public const GET = 'GET'; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $value; |
||
33 | |||
34 | /** |
||
35 | * Constructor. |
||
36 | * |
||
37 | * @param string $value |
||
38 | * |
||
39 | * @throws \InvalidArgumentException |
||
40 | */ |
||
41 | 12 | public function __construct(string $value) |
|
53 | |||
54 | /** |
||
55 | * Create POST method |
||
56 | * |
||
57 | * @return Method |
||
58 | */ |
||
59 | 7 | public static function post(): Method |
|
63 | |||
64 | /** |
||
65 | * Create PUT method |
||
66 | * |
||
67 | * @return Method |
||
68 | */ |
||
69 | 2 | public static function put(): Method |
|
73 | |||
74 | /** |
||
75 | * Create PATCH method |
||
76 | * |
||
77 | * @return Method |
||
78 | */ |
||
79 | 1 | public static function patch(): Method |
|
83 | |||
84 | /** |
||
85 | * Create DELETE method |
||
86 | * |
||
87 | * @return Method |
||
88 | */ |
||
89 | 1 | public static function delete(): Method |
|
93 | |||
94 | /** |
||
95 | * Create GET method |
||
96 | * |
||
97 | * @return Method |
||
98 | */ |
||
99 | 1 | public static function get(): Method |
|
103 | |||
104 | /** |
||
105 | * Get the value of method |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | 5 | public function getValue(): string |
|
113 | |||
114 | /** |
||
115 | * Get the possible values of action method |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | 13 | public static function getPossibleValues(): array |
|
129 | } |
||
130 |