src/Utilities/SVGStyleParser.php
public static function parseCss($css)
    {
        $result = array();
        preg_match_all('/(?ims)([a-z0-9\s\,\.\:#_\-@^*()\[\]\"\'=]+)\{([^\}]*)\}/', $css, $arr);

        foreach ($arr[0] as $i => $x) {
            $selectors = explode(',', trim($arr[1][$i]));
            if (in_array($selectors[0], array('@font-face', '@keyframes', '@media'))) {
                continue;
            }
            $rules = self::parseStyles(trim($arr[2][$i]));
            foreach ($selectors as $selector) {
                $result[trim($selector)] = $rules;
            }
        }

        return $result;
    }
public static function parseCss($css)
    {
        $result = array();
        preg_match_all('/(?ims)([a-z0-9\s\,\.\:#_\-@^*()\[\]\"\'=]+)\{([^\}]*)\}/', $css, $arr);

        foreach ($arr[0] as $i => $x) {
            $selectors = explode(',', trim($arr[1][$i]));
            if (in_array($selectors[0], array('@font-face', '@keyframes', '@media'))) {
                continue;
            }
            $rules = self::parseStyles(trim($arr[2][$i]));
            foreach ($selectors as $selector) {
                $result[trim($selector)] = $rules;
            }
        }

        return $result;
    }
public static function parseCss ( $ css ) { $ result = array ( ) ; preg_match_all ( '/(?ims)([a-z0-9\s\,\.\:#_\-@^*()\[\]\"\'=]+)\{([^\}]*)\}/' , $ css , $ arr ) ; foreach ( $ arr [ 0 ] as $ i => $ x ) { $ selectors = explode ( ',' , trim ( $ arr [ 1 ] [ $ i ] ) ) ; if ( in_array ( $ selectors [ 0 ] , array ( '@font-face' , '@keyframes' , '@media' ) ) ) { continue ; } $ rules = self :: parseStyles ( trim ( $ arr [ 2 ] [ $ i ] ) ) ; foreach ( $ selectors as $ selector ) { $ result [ trim ( $ selector ) ] = $ rules ; } } return $ result ; }
Parses CSS content into an associative 2D array of all selectors and
their respective style declarations.

@SuppressWarnings(PHPMD.UnusedLocalVariable)

@param string $css The CSS style rules.

@return string[][] A 2D associative array with style declarations.
Parses CSS content into an associative 2D array of all selectors and their respective style declarations .