function UriRetriever::parse
Parses a URI into five main components
Parameters
string $uri:
Return value
array
2 calls to UriRetriever::parse()
- UriRetriever::isValid in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Uri/ UriRetriever.php - UriRetriever::resolve in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Uri/ UriRetriever.php - Resolves a URI
File
-
vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Uri/ UriRetriever.php, line 242
Class
- UriRetriever
- Retrieves JSON Schema URIs
Namespace
JsonSchema\UriCode
public function parse($uri) {
preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?|', $uri, $match);
$components = array();
if (5 < count($match)) {
$components = array(
'scheme' => $match[2],
'authority' => $match[4],
'path' => $match[5],
);
}
if (7 < count($match)) {
$components['query'] = $match[7];
}
if (9 < count($match)) {
$components['fragment'] = $match[9];
}
return $components;
}