public function testExtend() { $objLegend = $this->objLegend->getPalette()->createLegend('second'); $objLegend->extend($this->objLegend); $this->assertEquals($objLegend->asArray(), $this->objLegend->asArray()); $objLegend->createProperty('final'); $this->assertNotEquals($objLegend->asArray(), $this->objLegend->asArray()); }
/** * Load definition from the dca * * @return $this; */ protected function loadFromDefinition() { $arrDefinition = explode(';', $this->getDefinition()); // go throw each legend foreach ($arrDefinition as $strLegend) { if ($strLegend == '') { continue; } $arrProperties = explode(',', $strLegend); // extract legend title and modifier preg_match('/\\{(.*)_legend(:hide)?\\}/', $arrProperties[0], $matches); array_shift($arrProperties); $objLegend = new Legend($matches[1], $this->getDataContainer(), $this); $this->arrLegends[$objLegend->getName()] = $objLegend; if (isset($matches[2])) { $objLegend->addModifier('hide'); } // create each property foreach ($arrProperties as $strProperty) { if ($strProperty != '' && $this->getDataContainer()->hasProperty($strProperty)) { $objLegend->addProperty($strProperty); } } } return $this; }