private function explode($palette)
{
if ('' === (string) $palette) {
return [];
}
$legendCount = 0;
$legendMap = [];
$groups = StringUtil::trimsplit(';', $palette);
foreach ($groups as $group) {
$hide = false;
$fields = StringUtil::trimsplit(',', $group);
if (preg_match('#\\{(.+?)(:hide)?\\}#', $fields[0], $matches)) {
$legend = $matches[1];
$hide = count($matches) > 2 && ':hide' === $matches[2];
array_shift($fields);
} else {
$legend = $legendCount++;
}
$legendMap[$legend] = ['fields' => $fields, 'hide' => $hide];
}
return $legendMap;
}