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

Breadcrumb

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

function UriRetriever::loadSchema

Fetch a schema from the given URI, json-decode it and return it. Caches schema objects.

Parameters

string $fetchUri Absolute URI:

Return value

object JSON schema object

1 call to UriRetriever::loadSchema()
UriRetriever::retrieve in vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php
Retrieve a URI

File

vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php, line 201

Class

UriRetriever
Retrieves JSON Schema URIs

Namespace

JsonSchema\Uri

Code

protected function loadSchema($fetchUri) {
    if (isset($this->schemaCache[$fetchUri])) {
        return $this->schemaCache[$fetchUri];
    }
    $uriRetriever = $this->getUriRetriever();
    $contents = $this->uriRetriever
        ->retrieve($fetchUri);
    $this->confirmMediaType($uriRetriever, $fetchUri);
    $jsonSchema = json_decode($contents);
    if (JSON_ERROR_NONE < ($error = json_last_error())) {
        throw new JsonDecodingException($error);
    }
    $this->schemaCache[$fetchUri] = $jsonSchema;
    return $jsonSchema;
}

API Navigation

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