/** * Retrieve the legend with the given name. * * @param string $name Name of the legend. * * @param PaletteInterface $palette The palette. * * @param LegendInterface $prevLegend The previous legend. * * @return LegendInterface */ protected function getLegend($name, $palette, $prevLegend = null) { if (!$palette->hasLegend($name)) { $palette->addLegend(new Legend($name), $prevLegend); } return $palette->getLegend($name); }
/** * Retrieve the legend with the given name. * * @param string $name Name of the legend. * * @param PaletteInterface $palette The palette. * * @param LegendInterface $prevLegend The previous legend. * * @return LegendInterface */ public function getLegend($name, $palette, $prevLegend = null) { if ($name[0] == '+') { $name = substr($name, 1); } if (!$palette->hasLegend($name)) { $palette->addLegend(new Legend($name), $prevLegend); } return $palette->getLegend($name); }