fetcher = $fetcher; } public function getGadgetSpec(GadgetContext $context) { return $this->getGadgetSpecUri($context->getUrl(), $context->getIgnoreCache()); } /** * Retrieves a gadget specification from the cache or from the Internet. */ public function getGadgetSpecUri($url, $ignoreCache) { return $this->fetchFromWeb($url, $ignoreCache); } /** * Retrieves a gadget specification from the Internet, processes its views and * adds it to the cache. */ private function fetchFromWeb($url, $ignoreCache) { $remoteContentRequest = new RemoteContentRequest($url); $remoteContentRequest->getRequest($url, $ignoreCache); $spec = $this->fetcher->fetchRequest($remoteContentRequest); $specParser = new GadgetSpecParser(); $context = new ProxyGadgetContext($url); $gadgetSpec = $specParser->parse($spec->getResponseContent(), $context); return $gadgetSpec; } }