Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UriRetriever.php

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\Uri

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal