'JsonSchema\Constraints\CollectionConstraint', 'collection' => 'JsonSchema\Constraints\CollectionConstraint', 'object' => 'JsonSchema\Constraints\ObjectConstraint', 'type' => 'JsonSchema\Constraints\TypeConstraint', 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint', 'string' => 'JsonSchema\Constraints\StringConstraint', 'number' => 'JsonSchema\Constraints\NumberConstraint', 'enum' => 'JsonSchema\Constraints\EnumConstraint', 'format' => 'JsonSchema\Constraints\FormatConstraint', 'schema' => 'JsonSchema\Constraints\SchemaConstraint', 'validator' => 'JsonSchema\Validator' ); /** @var array */ private $instanceCache = array(); /** * @param SchemaStorage $schemaStorage * @param UriRetrieverInterface $uriRetriever * @param int $checkMode */ public function __construct( SchemaStorageInterface $schemaStorage = null, UriRetrieverInterface $uriRetriever = null, $checkMode = Constraint::CHECK_MODE_NORMAL, ) { // set provided config options $this->setConfig($checkMode); $this->uriRetriever = $uriRetriever ?: new UriRetriever(); $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever); } /** * Set config values * * @param int $checkMode Set checkMode options - does not preserve existing flags */ public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL) { $this->checkMode = $checkMode; } /** * Enable checkMode flags * * @param int $options */ public function addConfig($options) { $this->checkMode |= $options; } /** * Disable checkMode flags * * @param int $options */ public function removeConfig($options) { $this->checkMode &= ~$options; } /** * Get checkMode option * * @param int $options Options to get, if null then return entire bitmask * * @return int */ public function getConfig($options = null) { if ($options === null) { return $this->checkMode; } return $this->checkMode & $options; } /** * @return UriRetrieverInterface */ public function getUriRetriever() { return $this->uriRetriever; } public function getSchemaStorage() { return $this->schemaStorage; } public function getTypeCheck() { if (!isset($this->typeCheck[$this->checkMode])) { $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST) ? new TypeCheck\LooseTypeCheck() : new TypeCheck\StrictTypeCheck(); } return $this->typeCheck[$this->checkMode]; } /** * @param string $name * @param string $class * * @return Factory */ public function setConstraintClass($name, $class) { // Ensure class exists if (!class_exists($class)) { throw new InvalidArgumentException('Unknown constraint ' . $name); } // Ensure class is appropriate if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) { throw new InvalidArgumentException('Invalid class ' . $name); } $this->constraintMap[$name] = $class; return $this; } /** * Create a constraint instance for the given constraint name. * * @param string $constraintName * * @throws InvalidArgumentException if is not possible create the constraint instance * * @return ConstraintInterface|ObjectConstraint */ public function createInstanceFor($constraintName) { if (!isset($this->constraintMap[$constraintName])) { throw new InvalidArgumentException('Unknown constraint ' . $constraintName); } if (!isset($this->instanceCache[$constraintName])) { $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this); } return clone $this->instanceCache[$constraintName]; } /** * Get the error context * * @return string */ public function getErrorContext() { return $this->errorContext; } /** * Set the error context * * @param string $validationContext */ public function setErrorContext($errorContext) { $this->errorContext = $errorContext; } } __halt_compiler();----SIGNATURE:----vBBZ2A2o1GJ3gXTGpkoBa+/gtS47M8NixlWtcDYO7deT1TSFTej8lc6WlWaY/5JovHHs+++fBGRVPJWxLQL7iYzUJJj7Ck0BOU1S/kptHhaZY/vt8OcnpQCcDhG0VwHbP2hgIsc94aZI2Rqw10c/TWaqJGsgMsgSbHKKnOhOYMKbDquQ+UL1+gOXQ9MNniiNW9S79RPJ08Z1Exi5eQ8h/6wQy3PBvKmK6a8JaONV44VtTRTnWU5l6NFSUCrT6VXuoedg18WLVBuYC8Jff2fq8UtISg1oGtr9LPJCt0wslTtId/d4QITw+dJn7UWq+xUBZJ8T60uOmOaMzeEw7418/rkfirN9fJurW4ZMjl3CEA8/VVnVI+ZpfKuJe2pFNE1GFh9FGZ11ksAFMoVMYcD4Fto6z4Ws9UEngUbE+nv3BF+VRt4yuSCgmxRjaUgaedogjIWjgIyIOqF1r0nGr6F6n+ol+GVnf69udp4b3SBk0BqtnYuEgXM7DbKcJ+/Y+pchffeqI8diONMLoBe6PoTT/uHea2Iu6sSiy5h0i0OLILLfVYu2q5trZjvhmTzbCGssSa3qScTMDsOGgtDgC3AsUctHwsSKzAD9w3RQA+yWXvjW3rRM3lqXzKgWgE+0k4sQB0Kq3M1yOb98j2HkLT8DHZBRUTwk3GOmt4wRytmxHpg=----ATTACHMENT:----NzY1NzcwNDgyODAzNjgzOSAzMzcwMjM2NDQ2NDc0NjgxIDc2OTM2MjIxODU1MTg1MTY=