| Conditions | 5 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 11 | public function __invoke(ServerRequestInterface $request) : string |
|
| 27 | { |
||
| 28 | /* @var $requestBody array */ |
||
| 29 | 11 | $requestBody = $request->getParsedBody(); |
|
| 30 | |||
| 31 | 11 | if (is_object($requestBody) && array_key_exists($this->csrfDataKey, (array) $requestBody)) { |
|
| 32 | 4 | $arrayBody = (array) $requestBody; |
|
| 33 | |||
| 34 | 4 | return $this->ensureThatTheValueIsAString($arrayBody[$this->csrfDataKey]); |
|
| 35 | } |
||
| 36 | |||
| 37 | 7 | if (is_array($requestBody) && array_key_exists($this->csrfDataKey, $requestBody)) { |
|
| 38 | 2 | return $this->ensureThatTheValueIsAString($requestBody[$this->csrfDataKey]); |
|
| 39 | } |
||
| 40 | |||
| 41 | 5 | return ''; |
|
| 42 | } |
||
| 43 | |||
| 53 |