OXIESEC PANEL
- Current Dir:
/
/
usr
/
share
/
php
/
JsonSchema
/
Uri
/
Retrievers
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/20/2024 06:32:21 AM
rwxr-xr-x
📄
AbstractRetriever.php
626 bytes
10/21/2017 01:15:38 PM
rw-r--r--
📄
Curl.php
2.11 KB
10/21/2017 01:15:38 PM
rw-r--r--
📄
FileGetContents.php
2.6 KB
10/21/2017 01:15:38 PM
rw-r--r--
📄
PredefinedArray.php
1.27 KB
10/21/2017 01:15:38 PM
rw-r--r--
📄
UriRetrieverInterface.php
746 bytes
10/21/2017 01:15:38 PM
rw-r--r--
Editing: PredefinedArray.php
Close
<?php namespace JsonSchema\Uri\Retrievers; use JsonSchema\Validator; /** * URI retrieved based on a predefined array of schemas * * @example * * $retriever = new PredefinedArray(array( * 'http://acme.com/schemas/person#' => '{ ... }', * 'http://acme.com/schemas/address#' => '{ ... }', * )) * * $schema = $retriever->retrieve('http://acme.com/schemas/person#'); */ class PredefinedArray extends AbstractRetriever { /** * Contains schemas as URI => JSON * * @var array */ private $schemas; /** * Constructor * * @param array $schemas * @param string $contentType */ public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE) { $this->schemas = $schemas; $this->contentType = $contentType; } /** * {@inheritdoc} * * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve() */ public function retrieve($uri) { if (!array_key_exists($uri, $this->schemas)) { throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf( 'The JSON schema "%s" was not found.', $uri )); } return $this->schemas[$uri]; } }