private function explode(string $palette): array
    {
        if ('' === $palette) {
            return [];
        }

        $legendCount = 0;
        $legendMap = [];
        $groups = StringUtil::trimsplit(';', $palette);

        foreach ($groups as $group) {
            if ('' === $group) {
                continue;
            }

            $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] = compact('fields', 'hide');
        }

        return $legendMap;
    }
private function explode(string $palette): array
    {
        if ('' === $palette) {
            return [];
        }

        $legendCount = 0;
        $legendMap = [];
        $groups = StringUtil::trimsplit(';', $palette);

        foreach ($groups as $group) {
            if ('' === $group) {
                continue;
            }

            $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] = compact('fields', 'hide');
        }

        return $legendMap;
    }
private function explode ( string $ palette ) : array { if ( '' === $ palette ) { return [ ] ; } $ legendCount = 0 ; $ legendMap = [ ] ; $ groups = StringUtil :: trimsplit ( ';' , $ palette ) ; foreach ( $ groups as $ group ) { if ( '' === $ group ) { continue ; } $ 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 ] = compact ( 'fields' , 'hide' ) ; } return $ legendMap ; }
Converts a palette string to a configuration array.

@return array<string,array<string,string[]|bool>>
Converts a palette string to a configuration array .