*/ 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:----NbtKLhYq9e1wgmeptbSWcmgozPkycl+GBwYnmxFMo3+1bXYTI1QO3hG9XQdHrucJO9l5QMFAnfk6z9UBk6idKD/dCjMilCBK+d5n/i79IVZlxsJdcP0IKFZ0tz1CnO09vzetrz2iH2M1sdQc1bbC9l2M4jWYaOSO8z8S5lcC5dtfjI1oxkjiw0zJMICSbIz9WynbXctqpQ1BDdlAJfBOquuJ5ZS0Ds8WcK8fTny4lhgSe9cDr38UV5aQ1JSoRxk9molrimczfCtniy+WSM3+ZfV03IhtjMLJjQYGOsYk/cDj1MdryLaHhmr+GcvWsHgYhxRpw1cQ/kwCX4OM6Uo3MmPR1cvOsAL6/tQHYdztgMrSW6fxKtNLdtq6fmihbNHRthdCExrBVT62zY8gQ/P2/wmV2GOwTCpr8zGbwHXa+TCxRmLMxsbqWnL3mKMdnXOUAwQ6hIAMl0TOi9NiMZ6pUjtSzt/9HWBQxdyasOSEbzLVSEP8nhJjegutwehS5LAWJO2lEzq41P4+4+VJzXkJ/2ocIkXcxifk05mXAvJ0Ebf7chbHq9+Gt5F5TKO0gzID5SRLL5WtknxShOwhOgVa4m/CPwwdWWFiiNknbjZsZWU87k4lr4+RCBdHkEnBrmw7O5gCChTj+7jz1XmD891ZTiYuuBI3RkCER7AeyHkWVMc=----ATTACHMENT:----MTQ4NDc4MDE0OTA4NDY0OCA4NzQyNzc2NTcxOTY2NzE0IDc5NTc0ODcyMjEyNDQyNzc=