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