| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 4 | public function verifyToken(string $token): bool |
|
| 25 | { |
||
| 26 | 4 | if (!$this->verifyTokenStructure($token)) { |
|
| 27 | 1 | return false; |
|
| 28 | } |
||
| 29 | 3 | $tokenParts = $this->divideToken($token); |
|
| 30 | |||
| 31 | 3 | $receivedHeader = $tokenParts[0]; |
|
| 32 | 3 | $receivedPayload = $tokenParts[1]; |
|
| 33 | 3 | $receivedSignature = $tokenParts[2]; |
|
| 34 | |||
| 35 | 3 | $calculatedSignature = $this->calculateSignature($receivedHeader, $receivedPayload); |
|
| 36 | 3 | return $calculatedSignature === $receivedSignature; |
|
| 37 | } |
||
| 53 |