logger = $logger; $this->throttle = $throttle; $this->clock = $clock ?? 'time'; } public function error(string $message): void { try { $skipped = $this->throttle->pass(($this->clock)(), self::INTERVAL); } catch (Throwable $exception) { $this->logger->error($message); return; } if ($skipped === null) { return; } if ($skipped > 0) { $message .= sprintf( ' Перед этим не записано отказов: %d (не чаще строки в %d с).', $skipped, self::INTERVAL, ); } $this->logger->error($message); } }