Lines 88.88% 8 / 9
Methods 50.00% 1 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 token 100.00% 1 / 1 100.00% 1 / 1 2
 verify 87.50% 7 / 8 0.00% 0 / 1 3.02
12final class FakeGoogleIdTokenVerifier implements GoogleIdTokenVerifierInterface
13{
14    public static function token(string $googleId, string $email, bool $emailVerified = true): string
15    {
16        return \implode('|', ['fake', $googleId, $email, $emailVerified ? 'verified' : 'unverified']);
17    }
18
19    #[\Override]
20    public function verify(string $idToken): ?array
21    {
22        $parts = \explode('|', $idToken);
23
24        if (4 !== \count($parts) || 'fake' !== $parts[0]) {
25            return null;
26        }
27
28        return [
29            'sub' => $parts[1],
30            'email' => $parts[2],
31            'email_verified' => 'verified' === $parts[3],
32        ];
33    }
34}