code: protected function getLegend($name, $palette, $prevLegend = null)
      {
          if (strpos($name, '+') === 0) {
              $name = substr($name, 1);
          }
  
          if (!$palette->hasLegend($name)) {
              $palette->addLegend(new Legend($name), $prevLegend);
          }
  
          return $palette->getLegend($name);
      }
docs: 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