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 $prefix
  * @param bool $wantedResult
  *
  * @dataProvider startsWithDataProvider
  */
 public function testStartsWith($string, $prefix, $wantedResult)
 {
     $result = $this->stringUtility->startsWith($string, $prefix);
     $this->assertEquals($wantedResult, $result);
 }
 /**
  * @param string $header
  *
  * @return bool
  */
 private function isHTTPHeader($header)
 {
     $headerStartsWithHttp = $this->stringUtility->startsWith($header, self::HTTP_HEADER_PREFIX);
     return $headerStartsWithHttp;
 }