Ejemplo n.º 1
0
 /**
  * @param ProviderResource $resource
  *
  * @return \Iterator
  *
  * @throws ForeignResourceException A foreign resource was received.
  */
 public function fetch(ProviderResource $resource)
 {
     if ($resource->getProviderClassName() !== static::class) {
         throw new ForeignResourceException(sprintf('Cannot fetch data from foreign source: "%s".', get_class($resource)));
     }
     return $resource->fetch($this->connector, $this->options ? clone $this->options : null);
 }
Ejemplo n.º 2
0
 private function fetch(ProviderResource $resource, CacheAdvice $cacheAdvice = null)
 {
     $provider = $this->getProvider($resource->getProviderClassName(), $resource->getProviderTag());
     $this->applyCacheAdvice($provider, $cacheAdvice ?: $this->defaultCacheAdvice);
     return $provider->fetch($resource);
 }