protected function initHeaders() { $newUrl = $this->getNewUrl(); if (empty($newUrl) || $this->httpRequest->getUri() == $newUrl) { // Set infinity loop (508) $this->responseCode = 508; return; } $this->responseCode = 301; $this->headers['Location'] = $newUrl; }
/** * @param HttpRequestInterface $httpRequest * * @return array */ protected function getValuesFromRequest(HttpRequestInterface $httpRequest) { $values = array('websiteId' => null, 'mediaId' => null, 'cdnType' => MediaRequest::TYPE_STREAM, 'lastModified' => 0, 'chain' => ''); $paramsAsJson = $httpRequest->getParam($this->requestParameterName); $params = \json_decode($paramsAsJson, true); if (!is_array($params)) { return $values; } $params = array_change_key_case($params, CASE_LOWER); if (isset($params['websiteid'])) { $values['websiteId'] = $params['websiteid']; } if (isset($params['id'])) { $values['mediaId'] = $params['id']; } if (isset($params['type'])) { $values['cdnType'] = $params['type']; } if (isset($params['date'])) { $values['lastModified'] = $params['date']; } if (isset($params['chain'])) { $values['chain'] = $params['chain']; } return $values; }