| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function extract(ServerRequestInterface $request) : Token |
||
| 37 | { |
||
| 38 | $authorizationHeader = $request->getHeaderLine('Authorization'); |
||
| 39 | |||
| 40 | //Authorization: schema PublicKey:Signature:Nonce:Timestamp |
||
| 41 | |||
| 42 | $pattern = "^{$this->scheme}\s(?P<publicKey>[a-zA-z0-9]*):(?P<signature>[a-zA-Z0-9]*):" |
||
| 43 | . '(?P<nonce>[a-zA-Z0-9]*):(?P<timestamp>[0-9]*)$'; |
||
| 44 | $matches = []; |
||
| 45 | $matched = preg_match("/{$pattern}/", $authorizationHeader, $matches); |
||
| 46 | if (!$matched) { |
||
| 47 | throw new AuthenticationException(400, 'Bad Request'); |
||
| 48 | } |
||
| 49 | |||
| 50 | return new Token($matches['publicKey'], $matches['signature'], $matches['nonce'], $matches['timestamp']); |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.