Exemple #1
0
 /**
  * download resource
  * @return string
  */
 public function downloading()
 {
     $data = \explode("\n", parent::stroke2point(trim($this->getData())));
     $data[0] = explode(' #', $data[0]);
     $data[1] = self::CNB_CZK;
     $this->save($data);
 }
Exemple #2
0
 /**
  * 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();
 }