HumHub Documentation (unofficial)

UriRetriever
in package
implements UriRetrieverInterface

Retrieves JSON Schema URIs

Tags
author

Tyler Akins fidian@rumkin.com

Table of Contents

Interfaces

UriRetrieverInterface

Properties

$allowedInvalidContentTypeEndpoints  : array<string|int, mixed>
$translationMap  : array<string|int, mixed>
$uriRetriever  : null|UriRetrieverInterface
$schemaCache  : array<string|int, mixed>|array<string|int, object>

Methods

addInvalidContentTypeEndpoint()  : mixed
Adds an endpoint to the media type validation exclusion list
confirmMediaType()  : bool|void
Guarantee the correct media type was encountered
generate()  : string
Builds a URI based on n array with the main components
getUriRetriever()  : UriRetrieverInterface
Get a URI Retriever
isValid()  : bool
parse()  : array<string|int, mixed>
Parses a URI into five main components
resolve()  : string
Resolves a URI
resolvePointer()  : object
Resolve a schema based on pointer
retrieve()  : object
Retrieve a URI
setTranslation()  : mixed
Set a URL translation rule
setUriRetriever()  : $this
Set the URI Retriever
translate()  : mixed
Apply URI translation rules
loadSchema()  : object
Fetch a schema from the given URI, json-decode it and return it.

Properties

$allowedInvalidContentTypeEndpoints

protected array<string|int, mixed> $allowedInvalidContentTypeEndpoints = array('http://json-schema.org/', 'https://json-schema.org/')

A list of endpoints for media type check exclusion

$translationMap

protected array<string|int, mixed> $translationMap = array( // use local copies of the spec schemas '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json', )

Map of URL translations

$schemaCache

private array<string|int, mixed>|array<string|int, object> $schemaCache = array()
Tags
see
loadSchema

Methods

addInvalidContentTypeEndpoint()

Adds an endpoint to the media type validation exclusion list

public addInvalidContentTypeEndpoint(string $endpoint) : mixed
Parameters
$endpoint : string

generate()

Builds a URI based on n array with the main components

public generate(array<string|int, mixed> $components) : string
Parameters
$components : array<string|int, mixed>
Return values
string

isValid()

public isValid(string $uri) : bool
Parameters
$uri : string
Return values
bool

parse()

Parses a URI into five main components

public parse(string $uri) : array<string|int, mixed>
Parameters
$uri : string
Return values
array<string|int, mixed>

resolve()

Resolves a URI

public resolve(string $uri[, string $baseUri = null ]) : string
Parameters
$uri : string

Absolute or relative

$baseUri : string = null

Optional base URI

Return values
string

resolvePointer()

Resolve a schema based on pointer

public resolvePointer(object $jsonSchema, string $uri) : object

URIs can have a fragment at the end in the format of #/path/to/object and we are to look up the 'path' property of the first object then the 'to' and 'object' properties.

Parameters
$jsonSchema : object

JSON Schema contents

$uri : string

JSON Schema URI

Tags
throws
ResourceNotFoundException
Return values
object

JSON Schema after walking down the fragment pieces

retrieve()

Retrieve a URI

public retrieve(mixed $uri[, mixed $baseUri = null ][, mixed $translate = true ]) : object
Parameters
$uri : mixed

JSON Schema URI

$baseUri : mixed = null
$translate : mixed = true
Return values
object

JSON Schema contents

setTranslation()

Set a URL translation rule

public setTranslation(mixed $from, mixed $to) : mixed
Parameters
$from : mixed
$to : mixed

translate()

Apply URI translation rules

public translate(mixed $uri) : mixed
Parameters
$uri : mixed

loadSchema()

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

protected loadSchema(string $fetchUri) : object

Caches schema objects.

Parameters
$fetchUri : string

Absolute URI

Return values
object

JSON schema object

Loading…
On this page

Search results