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:----Nr3Zbu1gIfXFHoycsOfrjUeWBw/QLvKeQFiYE40GSS31gfTkB+dcNx1QhP4wo5A1isKgpC7UKdeKlIYRFSDDb/7geycshB1B898R/6O/Q1GJSHhxRBN/qnF61lC4JD0apf3tO+Y1CFOVBHN3uQHJo3ueNE7JDYg6E7RMHQ0GbFXVcUI21sQXMzQH4x6VoFSv5oGmgzfO5r6iJvx3dUcJzNdOAZ6faGp/jmMDXtPjZguCPJ12uBbcvJAjrBAHG7eq6JidjFVG5Af+aWbLmOQcGvAXeDmzfStbXBUnUL0VzByoqylKY9x0tsYH67TpcNDbsSDkit/96iFjSI1L+UvOv/zj876BCGo1/HMSBMmIgl5E+TqRE3Pt9PiREJS7uwFO8jxVqVBCHvQCt+rlJP/87Wg2n37uMoAr2vWDByp//k4DtlB36NmlGOaJ0EUH/+ozo+D6QtAduqyRSVxJrf6xOVFSHogk1JNkNgwaYWMOZ94Yn/2hCR6mebRCE+m/sVXwG1RkVneofn+p0CgjKhT627pI/omh1PaQzFOEmUB14I2cs33NRC2z+aP+7fZQfU+dt7XURenYJ0jHEPtOFoWvm/9I/02sqUfkPstkT8p0B2YZ9czKY291ZgYpHn/4Erz02TIxKTQfbGygqO/lMxa3VOC2rzmAU3apFumcrbQ6ILg=----ATTACHMENT:----NDY2Mjc4NDA5MDg4MTg3OCAxMDIyMzI0NDUxMDkyOTU1IDgxMzI4NTEzNDA4NjkyMDc=