Пример #1
0
 /**
  * Returns an array with all solar system hrefs. When response time is critical, using this call is not recommended
  * due to it causing over 1100 calls to CREST when not already cached.
  *
  * @return array in the form solarSystemId => href
  */
 public function getSolarSystemHrefs()
 {
     $dataKey = 'gathered:solarSystemHrefs';
     try {
         $dataObj = $this->client->getCache()->getItem($dataKey);
     } catch (Exceptions\KeyNotFoundInCacheException $e) {
         //instantiate data object
         $cacheableArrayClass = Config::getIveeClassName('CacheableArray');
         $dataObj = new $cacheableArrayClass($dataKey, 24 * 3600);
         //run the async queries
         $this->client->asyncGetMultiEndpointResponses($this->getConstellationHrefs(), function (Response $res) use($dataObj) {
             foreach ($res->content->systems as $system) {
                 $dataObj->data[EndpointHandler::parseTrailingIdFromUrl($system->href)] = $system->href;
             }
         }, null, static::CONSTELLATION_REPRESENTATION);
         $this->client->getCache()->setItem($dataObj);
     }
     return $dataObj->data;
 }