Ejemplo n.º 1
0
 /**
  * Extend an existing node of the same type
  *
  * @param Palette|string $palette
  *
  * @return $this
  *
  * @throws \RuntimeException
  */
 public function extend($palette)
 {
     list($strName, $objPalette) = Palette::argument($this->getDataContainer(), $palette);
     /** @var Palette $objPalette */
     foreach ($objPalette->getLegends() as $strName => $objLegend) {
         if (!$this->hasLegend($strName)) {
             $this->createLegend($strName);
         }
         $legend = $this->getLegend($strName);
         /** @var Property $property */
         foreach ($objLegend as $property) {
             if (!$legend->hasProperty($property)) {
                 $legend->addProperty($property);
             }
         }
     }
     $this->updateDefinition();
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * @param string|Palette $palette
  *
  * @return $this
  */
 public function removePalette($palette)
 {
     list($strName) = Palette::argument($this, $palette);
     if ($this->hasPalette($strName)) {
         unset($this->arrPalettes[$strName]);
         unset($this->definition['palettes'][$strName]);
     }
     return $this;
 }