public function getWrappedObject()
{
if ($this->wrappedObject->isInstantiated()) {
return $this->wrappedObject->getInstance();
}
if (null === $this->wrappedObject->getClassName() || !is_string($this->wrappedObject->getClassName())) {
return $this->wrappedObject->getInstance();
}
if (!class_exists($this->wrappedObject->getClassName())) {
throw $this->classNotFound();
}
if (is_object($this->wrappedObject->getInstance())) {
$this->wrappedObject->setInstantiated(true);
$instance = $this->wrappedObject->getInstance();
} else {
$instance = $this->instantiateWrappedObject();
$this->wrappedObject->setInstance($instance);
$this->wrappedObject->setInstantiated(true);
}
return $instance;
}