コード例 #1
0
ファイル: BaseSync.php プロジェクト: victordiges/Vatsimphp
 /**
  *
  * Use StatusSync to dynamically add the available
  * data urls to poll new data from
  * @param \Vatsimphp\Sync\StatusSync $sync
  * @param string $type - the type of urls to use (ie dataUrls)
  * @throws \Vatsimphp\Exception\RuntimeException
  */
 public function registerUrlFromStatus(\Vatsimphp\Sync\StatusSync $sync, $type)
 {
     $urls = $sync->loadData()->get($type)->toArray();
     if (empty($urls)) {
         throw new RuntimeException('Error loading urls from StatusSync');
     }
     $this->registerUrl($urls, true);
     return true;
 }
コード例 #2
0
ファイル: VatsimData.php プロジェクト: victordiges/Vatsimphp
 /**
  *
  * Prepare StatusSync object for reusage
  * @return StatusSync
  */
 protected function prepareSync()
 {
     if (!empty($this->statusSync)) {
         return $this->statusSync;
     }
     LoggerFactory::$file = $this->config['logFile'];
     LoggerFactory::$level = $this->config['logLevel'];
     $this->statusSync = $this->getStatusSync();
     $this->statusSync->setDefaults();
     $this->statusSync->cacheDir = $this->config['cacheDir'];
     $this->statusSync->refreshInterval = $this->config['statusRefresh'];
     if (!empty($this->config['statusUrl'])) {
         $this->statusSync->registerUrl($this->config['statusUrl'], true);
     }
     return $this->statusSync;
 }