*/ class JsonPointer { /** @var string */ private $filename; /** @var string[] */ private $propertyPaths = array(); /** @var bool Whether the value at this path was set from a schema default */ private $fromDefault = false; /** * @param string $value * * @throws InvalidArgumentException when $value is not a string */ public function __construct($value) { if (!is_string($value)) { throw new InvalidArgumentException('Ref value must be a string'); } $splitRef = explode('#', $value, 2); $this->filename = $splitRef[0]; if (array_key_exists(1, $splitRef)) { $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]); } } /** * @param string $propertyPathString * * @return string[] */ private function decodePropertyPaths($propertyPathString) { $paths = array(); foreach (explode('/', trim($propertyPathString, '/')) as $path) { $path = $this->decodePath($path); if (is_string($path) && '' !== $path) { $paths[] = $path; } } return $paths; } /** * @return array */ private function encodePropertyPaths() { return array_map( array($this, 'encodePath'), $this->getPropertyPaths() ); } /** * @param string $path * * @return string */ private function decodePath($path) { return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%')); } /** * @param string $path * * @return string */ private function encodePath($path) { return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25')); } /** * @return string */ public function getFilename() { return $this->filename; } /** * @return string[] */ public function getPropertyPaths() { return $this->propertyPaths; } /** * @param array $propertyPaths * * @return JsonPointer */ public function withPropertyPaths(array $propertyPaths) { $new = clone $this; $new->propertyPaths = $propertyPaths; return $new; } /** * @return string */ public function getPropertyPathAsString() { return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/'); } /** * @return string */ public function __toString() { return $this->getFilename() . $this->getPropertyPathAsString(); } /** * Mark the value at this path as being set from a schema default */ public function setFromDefault() { $this->fromDefault = true; } /** * Check whether the value at this path was set from a schema default * * @return bool */ public function fromDefault() { return $this->fromDefault; } } __halt_compiler();----SIGNATURE:----Abwit/Y7WYMInHAYEfMb/lc5MlpuvmtMZRCtkfRkuPBuBN92EdzKz9lpeszRgAmmYyNtm0H1IH05y5yj1Z5UA1vDIMcUB8DpT7A3RzAapiyYQpwf4sqYH/ArJrE4rRP8TswzwdVujOnJMTDLQ8MVRmR1N7jnfDBZh5Z4ODdzg4iW6fR4C6wGeuGBVog1QZPaBbIpl622RO4mC82XGvkjJPtIrMrTVJbMr5T4dchDM7RbuM261c7KFZuaogz5LZrEOPx6rUTdr93oXhBZglU6t7GasVVuhfQrnzsDYGGxISgjzIrrOmJ0NsNXAA1wTrc+20txEGUcSuojuw6+ks+J/PIj1BNquwhEBsu3gf3c/qRgxACsNqi2rXJtD6Q2Y6mAHIY0T3FJTEBQbIr3i9ADcA5EkFM/qPw8okOS9xuCnn2aodSqLow7zjaYunyOaqR14IMuynpkCTKj5HgKYMpiJeJv3pfRxiVFdGWmaNRzNm4HNzY3X1tRcRdkDNDTJLYyw+x6V+dJ/WBP1es/fBb6lnNWwjOVXKyNi+UFfMWlZSbEvsoAjpO60U62KjlzHHMGL9hr/As+8xtPJsABqJUlQgYEm45CCxu8kUjXD0+HnPhpLDbpy/g4oiUkFvUnXA3pK1FusMWT0/jhZBcCtsUWPL73r+N9LGDo+vYKv70lHO0=----ATTACHMENT:----OTk3MDM5Njg5ODI1MjQzNyA0NDY0NjE1MTk5NzMyMzA2IDM5NzA1OTg3MzE2MTg2MzM=