コード例 #1
0
ファイル: Exchange.php プロジェクト: rokerkony/Exchange
 /**
  * start download the source
  * @return void
  */
 protected function download(\DateTime $date = NULL)
 {
     if ($this->storage === NULL) {
         $this->storage = new File($this->context->cacheStorage, $date);
     } elseif (!is_object($this->storage)) {
         $this->storage = new $this->storage($this->context->cacheStorage, $date);
     }
     if ($this->download === NULL) {
         $this->download = new CnbDay($this->storage, $this->default, $date);
     } elseif (!is_object($this->download)) {
         $this->download = new $this->download($this->storage, $this->default, $date);
     }
     if (!$this->download instanceof IDownload) {
         throw new ExchangeException('Class for download must be instance of ' . __NAMESPACE__ . '\\IDownload.');
     }
     if (!$this->storage->needUpdate()) {
         return;
     }
     $this->download->downloading();
 }