Conditions | 5 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
45 | protected function getPreferredMethod(IRequest $request): string |
||
46 | { |
||
47 | 1 | $method = $request->getMethod(); |
|
48 | 1 | $isPost = IRequest::Post === $method; |
|
49 | 1 | $header = $request->getHeader(self::OVERRIDE_HEADER); |
|
50 | 1 | $param = $request->getQuery(self::OVERRIDE_PARAM); |
|
51 | 1 | if ($header && $isPost) { |
|
52 | 1 | return $header; |
|
53 | } |
||
54 | 1 | if ($param && $isPost) { |
|
55 | 1 | return strval($param); |
|
56 | } |
||
57 | 1 | return $request->getMethod(); |
|
58 | } |
||
60 |