コード例 #1
0
ファイル: AllianceList.php プロジェクト: yapeal/yapeal
 /**
  * @param EveApiReadWriteInterface $data
  * @param EveApiRetrieverInterface $retrievers
  * @param EveApiPreserverInterface $preservers
  * @param int                      $interval
  *
  * @throws LogicException
  * @return bool
  */
 public function oneShot(EveApiReadWriteInterface $data, EveApiRetrieverInterface $retrievers, EveApiPreserverInterface $preservers, &$interval)
 {
     if (!$this->gotApiLock($data)) {
         return false;
     }
     $retrievers->retrieveEveApi($data);
     if ($data->getEveApiXml() === false) {
         $mess = sprintf('Could NOT retrieve Eve Api data for %1$s/%2$s', strtolower($this->getSectionName()), $this->getApiName());
         $this->getLogger()->debug($mess);
         return false;
     }
     $this->xsltTransform($data);
     if ($this->isInvalid($data)) {
         $mess = sprintf('Data retrieved is invalid for %1$s/%2$s', strtolower($this->getSectionName()), $this->getApiName());
         $this->getLogger()->warning($mess);
         $data->setEveApiName('Invalid' . $this->getApiName());
         $preservers->preserveEveApi($data);
         return false;
     }
     $preservers->preserveEveApi($data);
     // No need / way to preserve XML errors to the database with normal
     // preserve.
     if ($this->isEveApiXmlError($data, $interval)) {
         return true;
     }
     return $this->preserve($data->getEveApiXml());
 }
コード例 #2
0
 /**
  * @param EveApiReadWriteInterface $data
  * @param EveApiRetrieverInterface $retrievers
  * @param EveApiPreserverInterface $preservers
  * @param int                      $interval
  *
  * @throws LogicException
  * @return bool
  */
 public function oneShot(EveApiReadWriteInterface $data, EveApiRetrieverInterface $retrievers, EveApiPreserverInterface $preservers, &$interval)
 {
     if (!$this->gotApiLock($data)) {
         return false;
     }
     $corp = $data->getEveApiArguments();
     $corpID = $corp['corporationID'];
     // Can NOT include corporationID or only get public info.
     if (array_key_exists('keyID', $corp)) {
         unset($corp['corporationID']);
         $data->setEveApiArguments($corp);
     }
     $retrievers->retrieveEveApi($data);
     if ($data->getEveApiXml() === false) {
         $mess = sprintf('Could NOT retrieve any data from Eve API %1$s/%2$s for %3$s', strtolower($this->getSectionName()), $this->getApiName(), $corpID);
         $this->getLogger()->notice($mess);
         return false;
     }
     $this->xsltTransform($data);
     if ($this->isInvalid($data)) {
         $mess = sprintf('The data retrieved from Eve API %1$s/%2$s for %3$s is invalid', strtolower($this->getSectionName()), $this->getApiName(), $corpID);
         $this->getLogger()->warning($mess);
         $data->setEveApiName('Invalid' . $this->getApiName());
         $preservers->preserveEveApi($data);
         return false;
     }
     $preservers->preserveEveApi($data);
     // No need / way to preserve XML errors to the database with normal
     // preserve.
     if ($this->isEveApiXmlError($data, $interval)) {
         return true;
     }
     return $this->preserve($data->getEveApiXml(), $corpID);
 }
コード例 #3
0
ファイル: AbstractAccountKey.php プロジェクト: yapeal/yapeal
 /**
  * @param EveApiReadWriteInterface $data
  * @param EveApiRetrieverInterface $retrievers
  * @param EveApiPreserverInterface $preservers
  * @param int                      $interval
  *
  * @throws LogicException
  * @return bool
  */
 public function oneShot(EveApiReadWriteInterface $data, EveApiRetrieverInterface $retrievers, EveApiPreserverInterface $preservers, &$interval)
 {
     if (!$this->gotApiLock($data)) {
         return false;
     }
     if ('Char' === $this->getSectionName()) {
         $ownerID = $data->getEveApiArgument('characterID');
     } else {
         $ownerID = $data->getEveApiArgument('corporationID');
     }
     $accountKey = $data->getEveApiArgument('accountKey');
     $retrievers->retrieveEveApi($data);
     if ($data->getEveApiXml() === false) {
         if ('10000' === $accountKey) {
             $mess = sprintf('Corporation %1$s does NOT have a faction warfare account %2$s', $ownerID, $accountKey);
             $this->getLogger()->info($mess);
             return false;
         }
         $mess = sprintf('Could NOT retrieve any data from Eve API %1$s/%2$s for %3$s on account %4$s', strtolower($this->getSectionName()), $this->getApiName(), $ownerID, $accountKey);
         $this->getLogger()->notice($mess);
         return false;
     }
     $this->xsltTransform($data);
     if ($this->isInvalid($data)) {
         $mess = sprintf('The data retrieved from Eve API %1$s/%2$s for %3$s on account %4$s is invalid', strtolower($this->getSectionName()), $this->getApiName(), $ownerID, $accountKey);
         $this->getLogger()->warning($mess);
         $data->setEveApiName('Invalid' . $this->getApiName());
         $preservers->preserveEveApi($data);
         return false;
     }
     $preservers->preserveEveApi($data);
     // No need / way to preserve XML errors to the database with normal
     // preserve.
     if ($this->isEveApiXmlError($data, $interval)) {
         return true;
     }
     $this->preserve($data->getEveApiXml(), $ownerID, $accountKey);
     return true;
 }