Total Complexity | 7 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | class HttpMethodBypass implements Bypass |
||
11 | { |
||
12 | /** |
||
13 | * HTTP Methods to bypass |
||
14 | * |
||
15 | * @var string[] |
||
16 | */ |
||
17 | private $methods = []; |
||
18 | |||
19 | /** |
||
20 | * Initialize the bypass with HTTP methods |
||
21 | * |
||
22 | * @param string[] ...$method |
||
23 | */ |
||
24 | public function __construct(...$methods) |
||
25 | { |
||
26 | $this->addMethods(...$methods); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Returns the list of methods |
||
31 | * |
||
32 | * @return string[] |
||
33 | */ |
||
34 | public function getMethods() |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Add new HTTP methods to the list |
||
41 | * |
||
42 | * @param string[] ...$methods |
||
43 | * |
||
44 | * return $this |
||
45 | */ |
||
46 | public function addMethods(...$methods) |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Returns true if the current process is running in CLI mode |
||
72 | * |
||
73 | * @param HTTPRequest $request |
||
74 | * |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function checkRequestForBypass(HTTPRequest $request) |
||
82 |