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