Lines 0.00% 0 / 6
Methods 0.00% 0 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 __construct 0.00% 0 / 1 0.00% 0 / 1 2
 verify 0.00% 0 / 5 0.00% 0 / 1 12
12final readonly class GoogleIdTokenVerifier implements GoogleIdTokenVerifierInterface
13{
14    public function __construct(
15        #[Autowire(env: 'OAUTH_GOOGLE_ID')] private string $oauthGoogleId,
16    ) {
17    }
18
19    #[\Override]
20    public function verify(string $idToken): ?array
21    {
22        try {
23            $payload = new Client(['client_id' => $this->oauthGoogleId])
24                ->verifyIdToken($idToken);
25        } catch (\UnexpectedValueException|\LogicException) {
26            return null;
27        }
28
29        return \is_array($payload) ? $payload : null;
30    }
31}