Conditions | 4 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.0312 |
Changes | 0 |
1 | <?php |
||
33 | public function authenticate(IInput $input): bool |
||
34 | { |
||
35 | 1 | $timestamp = time(); |
|
36 | 1 | $data = $input->getData(); |
|
37 | 1 | if (!isset($data[$this->requestTimeKey]) || !$data[$this->requestTimeKey]) { |
|
38 | throw new RequestTimeoutException('Request time not found in requested data.'); |
||
39 | } |
||
40 | |||
41 | 1 | $diff = $timestamp - $data[$this->requestTimeKey]; |
|
42 | 1 | if ($diff > $this->timeout) { |
|
43 | 1 | throw new RequestTimeoutException('Request timeout'); |
|
44 | } |
||
45 | |||
46 | 1 | return true; |
|
47 | } |
||
49 |