Пример #1
0
 /**
  * @param UriInterface         $referenceUri
  * @param Value\ReferenceValue $reference
  *
  * @return Value\ValueInterface
  * @throws Exception\UndefinedReferenceException
  */
 protected function resolveExternal(UriInterface $referenceUri, Value\ReferenceValue $reference)
 {
     try {
         $value = $this->reader()->read($this->uriFactory()->create($referenceUri->toString()), $reference->mimeType());
     } catch (ReadException $e) {
         throw new Exception\UndefinedReferenceException($reference, $this->currentBaseUri(), $e);
     }
     $this->pushScopeMap($this->scopeMapFactory()->create($referenceUri, $value));
     $value = $value->accept($this);
     $this->popScopeMap();
     $referencePointer = $this->pointerFactory()->createFromUri($referenceUri);
     if ($referencePointer->hasAtoms()) {
         $value = $this->pointerResolver()->resolve($referencePointer, $value);
         if (null === $value) {
             throw new Exception\UndefinedReferenceException($reference, $this->currentBaseUri());
         }
     }
     return $value;
 }