public function updateBanner() { $url = (new Owl())->getUrl('', 'banners'); $request = new Request($url); $request->getOptions()->set(CURLOPT_TIMEOUT, 8)->set(CURLOPT_RETURNTRANSFER, true)->set(CURLOPT_USERAGENT, $this->di->get('config')->curlUserAgent); $response = $request->send(); $httpCode = $response->getInfo(CURLINFO_HTTP_CODE); if ($response->hasError() || $httpCode != 200) { $error = $response->getError()->getMessage(); throw new \Exception("Ошибка!!! http code: {$httpCode} message: {$error} url: {$url}"); } $content = json_decode($response->getContent(), true); parent::createBanner($content); }
protected function createBanner($data) { $banners = json_decode($data['content'][1], true); parent::createBanner($banners); }