uri = $uri; $this->anchor = $anchor; $this->anchorValue = $anchorValue; } /** * @inheritDoc */ public function doValidate( \Opis\JsonSchema\ValidationContext $context, \Opis\JsonSchema\Schema $schema, ): ?ValidationError { if ($this->resolved === false) { $this->resolved = $context->loader()->loadSchemaById($this->uri); } if ($this->resolved === null) { throw new UnresolvedReferenceException((string)$this->uri, $schema, $context); } $new_context = $this->createContext($context, $schema); if (!$this->hasRecursiveAnchor($this->resolved)) { $this->setLastRefSchema($this->resolved); return $this->resolved->validate($new_context); } $ok_sender = $this->resolveSchema($context); if (!$ok_sender) { $this->setLastRefSchema($this->resolved); return $this->resolved->validate($new_context); } $this->setLastRefSchema($ok_sender); return $ok_sender->validate($new_context); } protected function resolveSchema(\Opis\JsonSchema\ValidationContext $context): ?\Opis\JsonSchema\Schema { $ok = null; $loader = $context->loader(); while ($context) { $sender = $context->sender(); if (!$sender) { break; } if (!$this->hasRecursiveAnchor($sender)) { if ($sender->info()->id()) { // id without recursiveAnchor break; } $sender = $loader->loadSchemaById($sender->info()->root()); if (!$sender || !$this->hasRecursiveAnchor($sender)) { // root without recursiveAnchor break; } } if ($sender->info()->id()) { // id with recursiveAnchor $ok = $sender; } else { // root with recursiveAnchor $ok = $loader->loadSchemaById($sender->info()->root()); } $context = $context->parent(); } return $ok; } protected function hasRecursiveAnchor(?\Opis\JsonSchema\Schema $schema): bool { if (!$schema) { return false; } $info = $schema->info(); if (!$info->isObject()) { return false; } $data = $info->data(); if (!property_exists($data, $this->anchor)) { return false; } return $data->{$this->anchor} === $this->anchorValue; } } __halt_compiler();----SIGNATURE:----a2/qVCeW1BYURYaFeN4IweR/RdxbsQWCRMGF5fgXjQKDQMpKMuQLCGmr1g7ol/EHqJtNPcZG5ms+49iFz4TsTKVZanb+uPUu4vOJ9/YWBNfiBvoLnBr8DTD3ozu6BHU8R0GO0HHOVBysFZ6uduG6Crma2A8uYqwjcVlgdzmjeLpzNXgZhSk1LSvG0m7tXulksE+1DfjWjxPXmJE/o4hfSsho5WMOrWblZ/xD6LoiErDXPIeMBhh2zFx0Enr0G5MDc4wIeffaimZUKIDvHuMszU+PsgKZIDMBjrC5mMSz4ZaQ/0mGXKGpEf3U3gR/J3lQnNxFcxIqzIelBI0fFZoPeYJgh4SmhxbgOFrtvIzkPIJmgwP9IUucj3y3TnE4FCYpHfWtRHA0EnGqUPeoTQ6MmWmdZkW5d/e/nfnFvqjh/Zl4G7zbGsnDL3zkGcWdpwVW0fUfQ+Q+4QEfLj2VFRTzFY7b/nhsY4atUXXtE/R5HkirNUfiGr8CFwG1I8OrEM57Ux1OBcJe5oEG1vldub/xI9ahSvCTdtHF6oS7XltRNOEmMdmckKioHD7flZdDbKj++UBML/nbwptUSHTtMLB2sdRqfzA2AZ+n/e3RP2YROsbsG+w5r3in6ben7ZPLDPH9626XfhOV3XEoDUdYraQtsqXcDZnwrZzYhOZAiiuNh6E=----ATTACHMENT:----NTUxMjcyOTI0ODA5NzkzNyA1NDM0MTM0OTkxMDMwNjk5IDgxNDEyMzU3MzA4MTc4Mg==