*/ class FileGetContents extends AbstractRetriever { protected $messageBody; /** * {@inheritdoc} * * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve() */ public function retrieve($uri) { $errorMessage = null; set_error_handler(function ($errno, $errstr) use (&$errorMessage) { $errorMessage = $errstr; }); $response = file_get_contents($uri); restore_error_handler(); if ($errorMessage) { throw new ResourceNotFoundException($errorMessage); } if (false === $response) { throw new ResourceNotFoundException('JSON schema not found at ' . $uri); } if ($response == '' && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/' ) { throw new ResourceNotFoundException('JSON schema not found at ' . $uri); } $this->messageBody = $response; if (!empty($http_response_header)) { // $http_response_header cannot be tested, because it's defined in the method's local scope // See http://php.net/manual/en/reserved.variables.httpresponseheader.php for more info. $this->fetchContentType($http_response_header); // @codeCoverageIgnore } else { // @codeCoverageIgnore // Could be a "file://" url or something else - fake up the response $this->contentType = null; } return $this->messageBody; } /** * @param array $headers HTTP Response Headers * * @return bool Whether the Content-Type header was found or not */ private function fetchContentType(array $headers) { foreach ($headers as $header) { if ($this->contentType = self::getContentTypeMatchInHeader($header)) { return true; } } return false; } /** * @param string $header * * @return string|null */ protected static function getContentTypeMatchInHeader($header) { if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) { return trim($match[1]); } return null; } } __halt_compiler();----SIGNATURE:----IjyaBxl5tOdvYLNCDT+iOygRuBt24bEtdgOl7m81PenWFMP+wZim45RBvFat6WNG6Au+E4hApGm0jjAm44xXryK1XU7rh594MRN6c+rTGX27t8SJSaLPp+Meo85TsM2cOAL91HdmxDoGgQzLJGyUIx18iSLHKQFO/0/M3tAKQLnFfAKDc+5+ZeMgmkMaOeLw+mPsdXZnmyyWBkIMujArxNyrzaf1ikkRiOPsHB4/c20lcchxs6EZ38LpaYE93eND/RuZUoQc+BCMwrAr3hr4VxZKKMPsrgBHwzJrCEnHmJU/2VirObdE94lXOymdP0tnxfnOMZW4MNKHmI65QIu2xn0zKGElCOey2SVEg1zFHoTRJV/N9pVweIw2kvLi+ztFakSHM1dAwm17g4rZaWN9MbnnbVfG418A7Z4y48fj+7ep8IcFeJ44yk9fcxJFaksrx5JJ7IrgP9oF1tTfCRkgAF1xBIKG3pdazSbmMk5BgGTBu0p93Lp6t5hbYc1cc6/M0p47a0CPeOOsVna7o6EWJIPvaBXxg3TuxHR1pDJ5zTIS18nHrYb7qBxxHQVuJpcJnCXETM9F3yUHMrXWtND6W2L+qMywyIqtT5Ksp04qv/8aIr3iRuC4GONo0GAcEyT9O+BYbGyAXMMTwfLPPWbrjz7p0chAMHMw6PnhD8Oj1M4=----ATTACHMENT:----MTc4NTQzMzgzMjA5NDUgMzAyNDQ0MDg2MjUyMjM5MiAyMTMxNTg3MzA1NDk2NDg4