/** * Resolve XRef to object. * * @param string $name * * @return Element|Object * @throws \Exception */ protected function resolveXRef($name) { if (($obj = $this->elements[$name]) instanceof ElementXRef && !is_null($this->document)) { /** @var ElementXRef $obj */ $object = $this->document->getObjectById($obj->getId()); if (is_null($object)) { return null; } // Update elements list for future calls. $this->elements[$name] = $object; } return $this->elements[$name]; }
/** * Resolve XRef to object. * * @param string $name * * @return Element|Object * @throws \Exception */ protected function resolveXRef($name) { if (($obj = $this->elements[$name]) instanceof ElementXRef && !is_null($this->document)) { /** @var ElementXRef $obj */ $object = $this->document->getObjectById($obj->getId()); if (is_null($object)) { throw new \Exception('Missing object reference #' . $obj->getId() . '.'); } // Update elements list for future calls. $this->elements[$name] = $object; } return $this->elements[$name]; }