public function setContainer(ShapeContainerInterface $pValue = null, $pOverrideOld = false)
{
if (is_null($this->container)) {
// Add drawing to \PhpOffice\PhpPresentation\ShapeContainerInterface
$this->container = $pValue;
if (!is_null($this->container)) {
$this->container->getShapeCollection()->append($this);
}
} else {
if ($pOverrideOld) {
// Remove drawing from old \PhpOffice\PhpPresentation\ShapeContainerInterface
$iterator = $this->container->getShapeCollection()->getIterator();
while ($iterator->valid()) {
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
$this->container->getShapeCollection()->offsetUnset($iterator->key());
$this->container = null;
break;
}
$iterator->next();
}
// Set new \PhpOffice\PhpPresentation\Slide
$this->setContainer($pValue);
} else {
throw new \Exception("A \\PhpOffice\\PhpPresentation\\ShapeContainerInterface has already been assigned. Shapes can only exist on one \\PhpOffice\\PhpPresentation\\ShapeContainerInterface.");
}
}
return $this;
}