METHOD__); if ($this->cache->has($cacheKey)) { $this->body = $this->cache->get($cacheKey); } else { $clientResponse = $this->client->get('video/news', [ 'query' => $query, ]); if ($clientResponse->getStatusCode() === 200) { $this->body = $clientResponse->getBody()->getContents(); $this->cache->set($cacheKey, $this->body, $this->cacheTtl); } } return $this; } /** * @param array $query * @param string $prefix * @return string */ private function _createCacheKey($query = [], $prefix = '') { return $prefix . http_build_query($query); } /** * @param bool $asArray * * @return array|object|null */ public function getBody($asArray = true) { return json_decode($this->body, $asArray); } /** * @return string|null */ public function getResponseString() { return $this->body; } /** * @param array $query * * @return FranchiseDetailsInterface|null */ public function getFranchiseDetails($query) { $this->body = null; $query = array_merge($query, [ 'token' => $this->apiKey, ]); $cacheKey = $this->_createCacheKey($query, __METHOD__); if ($this->cache->has($cacheKey)) { $this->body = $this->cache->get($cacheKey); } else { $clientResponse = $this->client->get('franchise/details', [ 'query' => $query, ]); if ($clientResponse->getStatusCode() === 200) { $this->body = $clientResponse->getBody()->getContents(); $this->cache->set($cacheKey, $this->body, $this->cacheTtl); } } return ResponseFactory::createFranchiseDetail($this->getBody()); } /** * @param array $query * * @return $this */ public function getGenres($query) { $this->body = null; $query = array_merge($query, [ 'token' => $this->apiKey, ]); $cacheKey = $this->_createCacheKey($query, __METHOD__); if ($this->cache->has($cacheKey)) { $this->body = $this->cache->get($cacheKey); return $this; } $clientResponse = $this->client->get('genre', [ 'query' => $query, ]); if ($clientResponse->getStatusCode() === 200) { $this->body = $clientResponse->getBody()->getContents(); $this->cache->set($cacheKey, $this->body, $this->cacheTtl); } return $this; } /** * @param array $query * * @return $this */ public function getCountry($query) { $this->body = null; $query = array_merge($query, [ 'token' => $this->apiKey, ]); $cacheKey = $this->_createCacheKey($query, __METHOD__); if ($this->cache->has($cacheKey)) { $this->body = $this->cache->get($cacheKey); return $this; } $clientResponse = $this->client->get('country', [ 'query' => $query, ]); if ($clientResponse->getStatusCode() === 200) { $this->body = $clientResponse->getBody()->getContents(); $this->cache->set($cacheKey, $this->body, $this->cacheTtl); } return $this; } /** * @param array $query * * @return $this */ public function getList($query) { $this->body = null; $query = array_merge($query, [ 'token' => $this->apiKey, ]); $cacheKey = $this->_createCacheKey($query, __METHOD__); if ($this->cache->has($cacheKey)) { $this->body = $this->cache->get($cacheKey); return $this; } $clientResponse = $this->client->get('list', [ 'query' => $query, ]); if ($clientResponse->getStatusCode() === 200) { $this->body = $clientResponse->getBody()->getContents(); $this->cache->set($cacheKey, $this->body, $this->cacheTtl); } return $this; } /** * @return array */ public function getTrailersAll() { $clientResponse = $this->getTrailers([ 'limit' => 500, ]); $allNewVideo = $clientResponse->getBody(); $nextPage = $allNewVideo['next_page']; $results = $allNewVideo['results']; $page = 2; while ($nextPage !== null) { $clientResponse = $this->getTrailers([ 'limit' => 500, 'page' => $page, ]); $allNewVideo = $clientResponse->getBody(); $nextPage = $allNewVideo['next_page']; foreach ($allNewVideo['results'] as $result) { $results[] = $result; } $page++; } return $results; } /** * @param array $query * * @return $this */ public function getTrailers($query) { $this->body = null; $query = array_merge($query, [ 'token' => $this->apiKey, ]); $cacheKey = $this->_createCacheKey($query, __METHOD__); if ($this->cache->has($cacheKey)) { $this->body = $this->cache->get($cacheKey); return $this; } $clientResponse = $this->client->get('trailers', [ 'query' => $query, ]); if ($clientResponse->getStatusCode() === 200) { $this->body = $clientResponse->getBody()->getContents(); $this->cache->set($cacheKey, $this->body, $this->cacheTtl); } return $this; } /** * @param array $query * * @return CollectionInterface[]|null */ public function getCollections($query) { $this->body = null; $query = array_merge($query, [ 'token' => $this->apiKey, ]); $cacheKey = $this->_createCacheKey($query, __METHOD__); if ($this->cache->has($cacheKey)) { $this->body = $this->cache->get($cacheKey); } else { $clientResponse = $this->client->get('collection', [ 'query' => $query, ]); if ($clientResponse->getStatusCode() === 200) { $this->body = $clientResponse->getBody()->getContents(); $this->cache->set($cacheKey, $this->body, $this->cacheTtl); } } return ResponseFactory::createCollections($this->getBody()); } /** * @param array $query * * @return VoiceActionInterface[]|null */ public function getVoices($query) { $this->body = null; $query = array_merge($query, [ 'token' => $this->apiKey, ]); $cacheKey = $this->_createCacheKey($query, __METHOD__); if ($this->cache->has($cacheKey)) { $this->body = $this->cache->get($cacheKey); } else { $clientResponse = $this->client->get('voice-acting', [ 'query' => $query, ]); if ($clientResponse->getStatusCode() === 200) { $this->body = $clientResponse->getBody()->getContents(); $this->cache->set($cacheKey, $this->body, $this->cacheTtl); } } return ResponseFactory::createVoiceAction($this->getBody()); } /** * @return int */ public function validateApiKey() { if (empty($this->apiKey)) { return 0; } $clientResponse = $this->client->get('checked-key', [ 'query' => [ 'key' => $this->apiKey ], ]); return (int)($clientResponse->getStatusCode() === 200); } /** * @param array $query * * @return PromiseInterface */ public function getFranchiseDetailsAsync($query) { $query = array_merge($query, [ 'token' => $this->apiKey, ]); return $this->client->getAsync('franchise/details', [ 'query' => $query, ]); } /** * @param array $query * * @return PromiseInterface */ public function getFranchiseCalendarAsync($query) { $query = array_merge($query, [ 'token' => $this->apiKey, ]); return $this->client->getAsync('franchise/calendar', [ 'query' => $query, ]); } /** * @param array $query * * @return PromiseInterface */ public function getListAsync($query) { $query = array_merge($query, [ 'token' => $this->apiKey, ]); return $this->client->getAsync('list', [ 'query' => $query, ]); } /** * @param array $responses * @return array */ public function promiseResponseJsonToArray($responses) { $log = new Log(); $responseArray = []; foreach ($responses as $index => $response) { if ($response['state'] === 'rejected') { /** @var ConnectException $connectException */ $connectException = $response['reason']; $log->write(LogType::ACTION_API, get_class($connectException) . ': ' . $connectException->getMessage() . ' ' . $connectException->getTraceAsString()); continue; } /** * @var GuzzleResponse $response */ $response = $response['value']; if ($response->getStatusCode() !== 200) { continue; } $arr = json_decode($response->getBody()->getContents(), true); $responseArray[$index] = $arr; } return $responseArray; } /** * @return $this */ public function getDomains() { $this->body = null; $query = [ 'token' => $this->apiKey, ]; $cacheKey = $this->_createCacheKey($query, __METHOD__); if ($this->cache->has($cacheKey)) { $this->body = $this->cache->get($cacheKey); return $this; } $clientResponse = $this->client->get('domains', [ 'query' => $query, ]); if ($clientResponse->getStatusCode() === 200) { $this->body = $clientResponse->getBody()->getContents(); $this->cache->set($cacheKey, $this->body, $this->cacheTtl); } return $this; } } Fatal error: Uncaught Error: Class 'CCDN\Helpers\Api\ApiHandler' not found in /var/www/u116785/data/www/kinolis.com/engine/modules/ccdn-calendar-fullstory.php:39 Stack trace: #0 /var/www/u116785/data/www/kinolis.com/engine/inc/CCDN/Helpers/Modules/CCDNModule.php(27): dle_template::{closure}('MODULE_CALENDAR...', Object(CCDN\Helpers\Caching\Cache)) #1 /var/www/u116785/data/www/kinolis.com/engine/modules/ccdn-calendar-fullstory.php(191): CCDN\Helpers\Modules\CCDNModule::run('MODULE_CALENDAR...', Object(Closure)) #2 /var/www/u116785/data/www/kinolis.com/engine/cache/system/plugins/382709a522a64f7983ce71c79762d151.php(470): include('/var/www/u11678...') #3 [internal function]: dle_template->load_file(Array) #4 /var/www/u116785/data/www/kinolis.com/engine/cache/system/plugins/382709a522a64f7983ce71c79762d151.php(1163): preg_replace_callback('#\\{include file...', Array, '
compile('c in /var/www/u116785/data/www/kinolis.com/engine/modules/ccdn-calendar-fullstory.php on line 39