/** * @return bool */ public function changeIPs() { try { $HTTPClient = new CURLClient(); $storage = new CSVStorage(Config::getStorageFilePath()); $newRecords = $storage->getNew(Config::$sysParams['LIMIT_OF_RECORDS_PROCESSING']); $recordsCount = count($newRecords); $services = []; for ($i = 0; $i < $recordsCount; $i++) { if (!isset($services[$newRecords[$i]->serviceName])) { $services[$newRecords[$i]->serviceName] = DomainServiceFactory::create($newRecords[$i]->serviceName, $HTTPClient); } $services[$newRecords[$i]->serviceName]->processIP($newRecords[$i]); $newRecords[$i]->status = 'DONE'; } $storage->saveList($newRecords); } catch (\Exception $e) { $this->errors[] = $e->getMessage(); $this->logMsg($e->getMessage()); } if (!empty($this->errors)) { return false; } return true; }