*/ 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:----P//KlcOJoVSHFnucO99k0L2s577cq+lqTJ+W5C7Ia4s6xTKdZh/ZFxXb+vGr/4VLiexzDPjnhFV37wLAS06FXpVkBWN5DX0bzLfROuwrQFgx7z37+5mT//xP5PDs2V+VG60ybqCsXIc2KtkIZ1/Jqng7mVgy5xarZgJpBr6c70RMeydza1YPn3ligkZei94asyemeXtOrPav9YVxroaFTTqFkgBNLLiXp1TFsVDSKJ0oI0bLjb0bI2VIaIxjXdpB2OH60vW64DlHPOzyQQvucby6JAJYa3YO4g8dOI6+w1fG2Wh15p4Rke34qBxfVR09Y6VHy5mlYbbkyh+lHk4lZPZq8G+qplkJRUvW0/KfqnifO/alrOkmNWKk0ow9OIhxTVBr6gbIbjKwDzFOBk1J67nfztqql4DxYZWNu/CBKDxDCgfenqPOsQZXRTfVKZg3FN72rnx5Or2/5MSbJzLgFB9rf8nL4p6iYnHpqsooPGWSsLQrGz0j5Icc62AYkVJMG5D5NfnYORT71aq7r1X21I9jFJEDQJwOtdDWQbYgjL1dYZliXpu17i0AQ2ZGdX3zctk8FmpojtN5WOrX6MPBugok12KbGLc3TwOG9ALVdaeEMC07DwN1qYZsOQlPxnuUuXPH5iQyub1wBd7PGORA0uBzF6u3EcQubAX6x2e4NwM=----ATTACHMENT:----OTg0NDkxMjI2MDQ4OTM3NCA0MDU1MTYwMzMxMzA1ODcgMjgxNTcwOTEzNjc2Mzg3Ng==