logger = $logger ?? new NullLogger(); } public function check(PublicKeyCredentialSource $publicKeyCredentialSource, int $currentCounter): void { try { Assertion::greaterThan($currentCounter, $publicKeyCredentialSource->getCounter(), 'Invalid counter.'); } catch (Throwable $throwable) { $this->logger->error('The counter is invalid', [ 'current' => $currentCounter, 'new' => $publicKeyCredentialSource->getCounter(), ]); throw $throwable; } } }