ex
Fork of mbed-os-example-mbed5-blinky by
Diff: dumi_doc-master/schema/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php
- Revision:
- 49:b9eb462f36a9
- Parent:
- 48:c7ee67edcf1d
- Child:
- 50:9ecaa144d1f3
--- a/dumi_doc-master/schema/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php Tue Jul 18 16:56:22 2017 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<?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];
- }
-}
