Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
32 | public function authenticate(IInput $input): bool |
||
33 | { |
||
34 | 1 | $requested = $this->getRequestedHash(); |
|
35 | 1 | if (!$requested) { |
|
36 | 1 | throw new AuthenticationException('Authentication header not found.'); |
|
37 | } |
||
38 | |||
39 | 1 | $expected = $this->getExpectedHash($input); |
|
40 | 1 | if ($requested !== $expected) { |
|
41 | 1 | throw new AuthenticationException('Authentication tokens do not match.'); |
|
42 | } |
||
43 | 1 | return true; |
|
44 | } |
||
65 |