src/Rasterization/Path/SVGPathParser.php
public function parse($description)
    {
        $commands = array();

        $matches  = array();
        $idString = implode('', array_keys(self::$commandLengths));
        preg_match_all('/(['.$idString.'])([^'.$idString.']*)/', $description, $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            $id   = $match[1];
            $args = $this->splitArguments($match[2]);

            $success = $this->parseCommandChain($id, $args, $commands);
            if (!$success) {
                break;
            }
        }

        return $commands;
    }
public function parse($description)
    {
        $commands = array();

        $matches  = array();
        $idString = implode('', array_keys(self::$commandLengths));
        preg_match_all('/(['.$idString.'])([^'.$idString.']*)/', $description, $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            $id   = $match[1];
            $args = $this->splitArguments($match[2]);

            $success = $this->parseCommandChain($id, $args, $commands);
            if (!$success) {
                break;
            }
        }

        return $commands;
    }
public function parse ( $ description ) { $ commands = array ( ) ; $ matches = array ( ) ; $ idString = implode ( '' , array_keys ( self :: $ commandLengths ) ) ; preg_match_all ( '/([' . $ idString . '])([^' . $ idString . ']*)/' , $ description , $ matches , PREG_SET_ORDER ) ; foreach ( $ matches as $ match ) { $ id = $ match [ 1 ] ; $ args = $ this -> splitArguments ( $ match [ 2 ] ) ; $ success = $ this -> parseCommandChain ( $ id , $ args , $ commands ) ; if ( ! $ success ) { break ; } } return $ commands ; }
Parses a path description into a consecutive array of commands.

The commands themselves are associative arrays with 2 keys:
- string 'id': the command's id, e.g. 'M' or 'c' or ...
- float[] 'args': consecutive array of command arguments

@param string $description The SVG path description to parse.

@return array[] An array of commands (structure: see above).
Parses a path description into a consecutive array of commands .