connection)) { $this->logger->debug('Connecting'); $r = 0; $exception = null; while($r < $this->retries) { try { $dsn = "mysql:host={$this->host};dbname={$this->name}"; $this->connection = new PDO($dsn, $this->username, $this->password); return $this->connection; } catch (PDOException $e) { $this->logger->debug('Retrying'); if ($exception !== null) { $e = new PDOException($e->getMessage(), $e->getCode(), $exception); } $exception = $e; } $r ++; } throw $exception; } return $this->connection; } }