/** * Returns the request * * @return \Cundd\Rest\Request */ public function getRequest() { if (!$this->request) { $uri = $this->getUri(); /* * Transform Document URLs * @Todo: Make this more flexible */ if ($this->stringHasPrefix($uri, Request::API_PATH_DOCUMENT . '/')) { $documentApiPathLength = strlen(Request::API_PATH_DOCUMENT) + 1; $uri = Request::API_PATH_DOCUMENT . '-' . substr($uri, $documentApiPathLength); } list($uri, $originalPath, $path) = $this->getRequestPathAndUriForUri($uri); $this->request = new Request(NULL, $uri); $this->request->initWithPathAndOriginalPath($path, $originalPath); $this->request->injectConfigurationProvider($this->configurationProvider); if ($this->format) { $this->request->format($this->format); } // fwrite(STDOUT, PHP_EOL . '-> ' . spl_object_hash($this) . ' ' . $uri . ' - ' . $this->getArgument('u', FILTER_SANITIZE_URL) . PHP_EOL); // } else { // fwrite(STDOUT, PHP_EOL . '<- ' . spl_object_hash($this) . ' ' . $this->getUri() . PHP_EOL); } return $this->request; }
/** * Returns the request * * @return \Cundd\Rest\Request */ public function getRequest() { if (!$this->request) { $format = ''; $uri = $this->getUri($format); /* * Transform Document URLs * @Todo: Make this better */ if (substr($uri, 0, 9) === 'Document/') { $uri = 'Document-' . substr($uri, 9); } $this->request = new Request(NULL, $uri); $this->request->injectConfigurationProvider($this->objectManager->getConfigurationProvider()); if ($format) { $this->request->format($format); } } return $this->request; }
/** * Returns the cache key for the current request * * @return string */ protected function _getCacheKey() { return sha1($this->currentRequest->url() . '_' . $this->currentRequest->format() . '_' . $this->currentRequest->method()); }