src/Utilities/SVGStyleParser.php
public static function parseStyles($string)
    {
        $styles = array();
        if (empty($string)) {
            return $styles;
        }

        $declarations = preg_split('/\s*;\s*/', $string);

        foreach ($declarations as $declaration) {
            $declaration = trim($declaration);
            if ($declaration === '') {
                continue;
            }
            $split             = preg_split('/\s*:\s*/', $declaration);
            $styles[$split[0]] = $split[1];
        }

        return $styles;
    }
public static function parseStyles($string)
    {
        $styles = array();
        if (empty($string)) {
            return $styles;
        }

        $declarations = preg_split('/\s*;\s*/', $string);

        foreach ($declarations as $declaration) {
            $declaration = trim($declaration);
            if ($declaration === '') {
                continue;
            }
            $split             = preg_split('/\s*:\s*/', $declaration);
            $styles[$split[0]] = $split[1];
        }

        return $styles;
    }
public static function parseStyles ( $ string ) { $ styles = array ( ) ; if ( empty ( $ string ) ) { return $ styles ; } $ declarations = preg_split ( '/\s*;\s*/' , $ string ) ; foreach ( $ declarations as $ declaration ) { $ declaration = trim ( $ declaration ) ; if ( $ declaration === '' ) { continue ; } $ split = preg_split ( '/\s*:\s*/' , $ declaration ) ; $ styles [ $ split [ 0 ] ] = $ split [ 1 ] ; } return $ styles ; }
Parses a string of CSS declarations into an associative array.

@param string $string The CSS declarations.

@return string[] An associative array of all declarations.
Parses a string of CSS declarations into an associative array .