Beispiel #1
0
 /**
  * @param EveApiReadWriteInterface $data
  * @param EveApiRetrieverInterface $retrievers
  * @param EveApiPreserverInterface $preservers
  * @param int                      $interval
  *
  * @throws LogicException
  */
 public function autoMagic(EveApiReadWriteInterface $data, EveApiRetrieverInterface $retrievers, EveApiPreserverInterface $preservers, $interval)
 {
     $this->getLogger()->debug(sprintf('Starting autoMagic for %1$s/%2$s', $this->getSectionName(), $this->getApiName()));
     if ('Char' === $this->getSectionName()) {
         $active = $this->getActiveCharacters();
         $ownerID = 'characterID';
     } else {
         $active = $this->getActiveCorporations();
         $ownerID = 'corporationID';
     }
     if (0 === count($active)) {
         $mess = sprintf('No active registered keys found for %1$s/%2$s', $this->getSectionName(), $this->getApiName());
         $this->getLogger()->info($mess);
         return;
     }
     foreach ($active as $activeKey) {
         if ($this->cacheNotExpired($this->getApiName(), $this->getSectionName(), $activeKey[$ownerID])) {
             continue;
         }
         foreach ($this->getKeyList() as $accountKey) {
             $data->setEveApiSectionName(strtolower($this->getSectionName()))->setEveApiName($this->getApiName());
             $activeKey['accountKey'] = $accountKey;
             $activeKey['rowCount'] = '2560';
             $data->setEveApiArguments($activeKey)->setEveApiXml();
             if (!$this->oneShot($data, $retrievers, $preservers, $interval)) {
                 // Special handling for optional faction warfare account.
                 if ('10000' === $accountKey) {
                     continue 1;
                 }
                 continue 2;
             }
         }
         $this->updateCachedUntil($data->getEveApiXml(), $interval, $activeKey[$ownerID]);
     }
 }
 /**
  * @param EveApiReadWriteInterface $data
  * @param EveApiRetrieverInterface $retrievers
  * @param EveApiPreserverInterface $preservers
  * @param int                      $interval
  *
  * @throws LogicException
  */
 public function autoMagic(EveApiReadWriteInterface $data, EveApiRetrieverInterface $retrievers, EveApiPreserverInterface $preservers, $interval)
 {
     $this->getLogger()->info(sprintf('Starting autoMagic for %1$s/%2$s', $this->getSectionName(), $this->getApiName()));
     $data->setEveApiSectionName(strtolower($this->getSectionName()))->setEveApiName($this->getApiName())->setEveApiArguments([])->setEveApiXml();
     if ($this->cacheNotExpired($this->getApiName(), $this->getSectionName())) {
         return;
     }
     if (!$this->oneShot($data, $retrievers, $preservers, $interval)) {
         return;
     }
     $this->updateCachedUntil($data->getEveApiXml(), $interval, '0');
 }
 /**
  * @param EveApiReadWriteInterface $data
  * @param EveApiRetrieverInterface $retrievers
  * @param EveApiPreserverInterface $preservers
  * @param int                      $interval
  *
  * @throws LogicException
  */
 public function autoMagic(EveApiReadWriteInterface $data, EveApiRetrieverInterface $retrievers, EveApiPreserverInterface $preservers, $interval)
 {
     $this->getLogger()->debug(sprintf('Starting autoMagic for %1$s/%2$s', $this->getSectionName(), $this->getApiName()));
     $active = $this->getActiveKeys();
     if (0 === count($active)) {
         $this->getLogger()->info('No active registered keys found');
         return;
     }
     foreach ($active as $key) {
         $data->setEveApiSectionName(strtolower($this->getSectionName()))->setEveApiName($this->getApiName());
         if ($this->cacheNotExpired($this->getApiName(), $this->getSectionName(), $key['keyID'])) {
             continue;
         }
         $data->setEveApiArguments($key)->setEveApiXml();
         $untilInterval = $interval;
         if (!$this->oneShot($data, $retrievers, $preservers, $untilInterval)) {
             continue;
         }
         $this->updateCachedUntil($data->getEveApiXml(), $untilInterval, $key['keyID']);
     }
 }