public function parsePhpDoc($pString)
    {
        preg_match('#^/\*\*(.*)\*/#s', trim($pString), $comment);

        if (0 === count($comment)) return array();

        $comment = trim($comment[1]);

        preg_match_all('/^\s*\*(.*)/m', $comment, $lines);
        $lines = $lines[1];

        $tags = array();
        $currentTag = '';
        $currentData = '';

        foreach ($lines as $line) {
            $line = trim($line);

            if (substr($line, 0, 1) == '@') {

                if ($currentTag)
                    $tags[$currentTag][] = $currentData;
                else
                    $tags['description'] = $currentData;

                $currentData = '';
                preg_match('/@([a-zA-Z_]*)/', $line, $match);
                $currentTag = $match[1];
            }

            $currentData = trim($currentData.' '.$line);

        }
        if ($currentTag)
            $tags[$currentTag][] = $currentData;
        else
            $tags['description'] = $currentData;

        //parse tags
        $regex = array(
            'param' => array('/^@param\s*\t*([a-zA-Z_\\\[\]]*)\s*\t*\$([a-zA-Z_]*)\s*\t*(.*)/', array('type', 'name', 'description')),
            'url' => array('/^@url\s*\t*(.+)/', array('url')),
            'return' => array('/^@return\s*\t*([a-zA-Z_\\\[\]]*)\s*\t*(.*)/', array('type', 'description')),
        );
        foreach ($tags as $tag => &$data) {
            if ($tag == 'description') continue;
            foreach ($data as &$item) {
                if (isset($regex[$tag])) {
                    preg_match($regex[$tag][0], $item, $match);
                    $item = array();
                    $c = count($match);
                    for ($i =1; $i < $c; $i++) {
                        if (isset($regex[$tag][1][$i-1])) {
                            $item[$regex[$tag][1][$i-1]] = $match[$i];
                        }
                    }
                }
            }
            if (count($data) == 1)
                $data = $data[0];
        }

        return $tags;
    }
public function parsePhpDoc($pString)
    {
        preg_match('#^/\*\*(.*)\*/#s', trim($pString), $comment);

        if (0 === count($comment)) return array();

        $comment = trim($comment[1]);

        preg_match_all('/^\s*\*(.*)/m', $comment, $lines);
        $lines = $lines[1];

        $tags = array();
        $currentTag = '';
        $currentData = '';

        foreach ($lines as $line) {
            $line = trim($line);

            if (substr($line, 0, 1) == '@') {

                if ($currentTag)
                    $tags[$currentTag][] = $currentData;
                else
                    $tags['description'] = $currentData;

                $currentData = '';
                preg_match('/@([a-zA-Z_]*)/', $line, $match);
                $currentTag = $match[1];
            }

            $currentData = trim($currentData.' '.$line);

        }
        if ($currentTag)
            $tags[$currentTag][] = $currentData;
        else
            $tags['description'] = $currentData;

        //parse tags
        $regex = array(
            'param' => array('/^@param\s*\t*([a-zA-Z_\\\[\]]*)\s*\t*\$([a-zA-Z_]*)\s*\t*(.*)/', array('type', 'name', 'description')),
            'url' => array('/^@url\s*\t*(.+)/', array('url')),
            'return' => array('/^@return\s*\t*([a-zA-Z_\\\[\]]*)\s*\t*(.*)/', array('type', 'description')),
        );
        foreach ($tags as $tag => &$data) {
            if ($tag == 'description') continue;
            foreach ($data as &$item) {
                if (isset($regex[$tag])) {
                    preg_match($regex[$tag][0], $item, $match);
                    $item = array();
                    $c = count($match);
                    for ($i =1; $i < $c; $i++) {
                        if (isset($regex[$tag][1][$i-1])) {
                            $item[$regex[$tag][1][$i-1]] = $match[$i];
                        }
                    }
                }
            }
            if (count($data) == 1)
                $data = $data[0];
        }

        return $tags;
    }
public function parsePhpDoc ( $ pString ) { preg_match ( '#^/\*\*(.*)\*/#s' , trim ( $ pString ) , $ comment ) ; if ( 0 === count ( $ comment ) ) return array ( ) ; $ comment = trim ( $ comment [ 1 ] ) ; preg_match_all ( '/^\s*\*(.*)/m' , $ comment , $ lines ) ; $ lines = $ lines [ 1 ] ; $ tags = array ( ) ; $ currentTag = '' ; $ currentData = '' ; foreach ( $ lines as $ line ) { $ line = trim ( $ line ) ; if ( substr ( $ line , 0 , 1 ) == '@' ) { if ( $ currentTag ) $ tags [ $ currentTag ] [ ] = $ currentData ; else $ tags [ 'description' ] = $ currentData ; $ currentData = '' ; preg_match ( '/@([a-zA-Z_]*)/' , $ line , $ match ) ; $ currentTag = $ match [ 1 ] ; } $ currentData = trim ( $ currentData . ' ' . $ line ) ; } if ( $ currentTag ) $ tags [ $ currentTag ] [ ] = $ currentData ; else $ tags [ 'description' ] = $ currentData ; //parse tags $ regex = array ( 'param' => array ( '/^@param\s*\t*([a-zA-Z_\\\[\]]*)\s*\t*\$([a-zA-Z_]*)\s*\t*(.*)/' , array ( 'type' , 'name' , 'description' ) ) , 'url' => array ( '/^@url\s*\t*(.+)/' , array ( 'url' ) ) , 'return' => array ( '/^@return\s*\t*([a-zA-Z_\\\[\]]*)\s*\t*(.*)/' , array ( 'type' , 'description' ) ) , ) ; foreach ( $ tags as $ tag => & $ data ) { if ( $ tag == 'description' ) continue ; foreach ( $ data as & $ item ) { if ( isset ( $ regex [ $ tag ] ) ) { preg_match ( $ regex [ $ tag ] [ 0 ] , $ item , $ match ) ; $ item = array ( ) ; $ c = count ( $ match ) ; for ( $ i = 1 ; $ i < $ c ; $ i ++ ) { if ( isset ( $ regex [ $ tag ] [ 1 ] [ $ i - 1 ] ) ) { $ item [ $ regex [ $ tag ] [ 1 ] [ $ i - 1 ] ] = $ match [ $ i ] ; } } } } if ( count ( $ data ) == 1 ) $ data = $ data [ 0 ] ; } return $ tags ; }
Parse phpDoc string and returns an array.

@param  string $pString
@return array
Parse phpDoc string and returns an array .