/**
  * @return string
  */
 private function readPath()
 {
     $uri = $_SERVER['REQUEST_URI'];
     $uriWithoutScript = $this->stringUtility->substringAfter($uri, '.php');
     $path = $this->stringUtility->substringBefore($uriWithoutScript, '?');
     $decodedPath = urldecode($path);
     return $decodedPath;
 }
 public function getDeserializedRequestContent($rawContent, HeaderCollectionInterface $headerCollection)
 {
     if (!empty($rawContent)) {
         $contentType = $headerCollection->getHeaderValue(HeaderName::CONTENT_TYPE);
         if ($this->stringUtility->contains($contentType, ContentType::APPLICATION_JSON)) {
             $deserializedContent = $this->serializer->deserialize($rawContent, 'array', 'json');
         } else {
             throw new UnsupportedMediaTypeException('Submitted media type not supported');
         }
     } else {
         $deserializedContent = [];
     }
     return $deserializedContent;
 }
 public function parseAuthorizationHeaderString($authorizationHeader)
 {
     if (!$this->stringUtility->startsWith($authorizationHeader, self::BASIC_PREFIX)) {
         throw new InvalidAuthorizationHeaderException('Authorization-Header-Value does not start with \'' . self::BASIC_PREFIX . '\'.');
     }
     $baseEncodedCredentials = $this->stringUtility->substringAfter($authorizationHeader, self::BASIC_PREFIX);
     $decodedCredentials = $this->base64Service->decode($baseEncodedCredentials);
     if ($decodedCredentials === '') {
         list($userIdentifier, $password) = ['', ''];
     } else {
         if (!$this->stringUtility->contains($decodedCredentials, self::CREDENTIALS_DELIMITER)) {
             throw new InvalidAuthorizationHeaderException('Decoded credentials are not delimited by \'' . self::CREDENTIALS_DELIMITER . '\'.');
         } else {
             list($userIdentifier, $password) = $this->stringUtility->split($decodedCredentials, self::CREDENTIALS_DELIMITER);
         }
     }
     return new Credentials($userIdentifier, $password);
 }
 /**
  * @param string $string
  * @param string $wantedResult
  *
  * @dataProvider removeWhitespaceDataProvider
  */
 public function testRemoveWhitespace($string, $wantedResult)
 {
     $result = $this->stringUtility->removeWhitespace($string);
     $this->assertEquals($wantedResult, $result);
 }
 /**
  * @param string $headerName
  *
  * @return string
  */
 private function removeHTTPPrefix($headerName)
 {
     $headerWithoutPrefix = $this->stringUtility->removePrefix($headerName, self::HTTP_HEADER_PREFIX);
     return $headerWithoutPrefix;
 }