public function fetch($source, EncapsulatedOptions $options = null) { $optionsCopy = $options ? $options->copy() : []; if ($this->isCacheEnabled()) { ksort($optionsCopy); $hash = $this->hash([$source, $optionsCopy]); if ($this->cache->hasItem($hash)) { return $this->cache->getItem($hash)->get(); } } $data = $this->fetchFreshData($source, $options); isset($hash) && $this->cache->save($this->cache->getItem($hash)->set($data)); return $data; }