protected function parseMethods(SimpleXMLElement $class)
    {
        $methods = [];

        $className = (string)$class->full_name;
        $className = ltrim($className, '\\');

        foreach ($class->method as $method) {
            $methodName = (string)$method->name;

            $return = $method->xpath('docblock/tag[@name="return"]');

            if (count($return)) {
                $return = (string)$return[0]['type'];
            } else {
                $return = 'mixed';
            }

            $arguments = [];

            foreach ($method->argument as $argument) {
                $nArgument = [
                    'type' => (string)$argument->type,
                    'name' => (string)$argument->name
                ];

                $tags = $method->xpath(
                    sprintf('docblock/tag[@name="param" and @variable="%s"]', $nArgument['name'])
                );

                if (count($tags)) {
                    $tag = $tags[0];

                    if ((string)$tag['type']) {
                        $nArgument['type'] = (string)$tag['type'];
                    }

                    if ((string)$tag['description']) {
                        $nArgument['description'] = (string)$tag['description'];
                    }

                    if ((string)$tag['variable']) {
                        $nArgument['name'] = (string)$tag['variable'];
                    }
                }

                $arguments[] = $nArgument;
            }

            $argumentStr = implode(', ', array_map(function($argument) {
                $return = $argument['name'];

                if ($argument['type']) {
                    $return = $argument['type'] . ' ' . $return;
                }

                return $return;
            }, $arguments));

            $signature = sprintf('%s %s::%s(%s)', $return, $className, $methodName, $argumentStr);

            $methods[$methodName] = [
                'name'        => $methodName,
                'description' => (string)$method->docblock->description . "\n\n" . (string)$method->docblock->{'long-description'},
                'visibility'  => (string)$method['visibility'],
                'abstract'    => ((string)$method['abstract']) == "true",
                'static'      => ((string)$method['static']) == "true",
                'deprecated'  => count($class->xpath('docblock/tag[@name="deprecated"]')) > 0,
                'signature'   => $signature,
                'arguments'   => $arguments,
                'definedBy'   => $className,
            ];
        }

        return $methods;
    }
protected function parseMethods(SimpleXMLElement $class)
    {
        $methods = [];

        $className = (string)$class->full_name;
        $className = ltrim($className, '\\');

        foreach ($class->method as $method) {
            $methodName = (string)$method->name;

            $return = $method->xpath('docblock/tag[@name="return"]');

            if (count($return)) {
                $return = (string)$return[0]['type'];
            } else {
                $return = 'mixed';
            }

            $arguments = [];

            foreach ($method->argument as $argument) {
                $nArgument = [
                    'type' => (string)$argument->type,
                    'name' => (string)$argument->name
                ];

                $tags = $method->xpath(
                    sprintf('docblock/tag[@name="param" and @variable="%s"]', $nArgument['name'])
                );

                if (count($tags)) {
                    $tag = $tags[0];

                    if ((string)$tag['type']) {
                        $nArgument['type'] = (string)$tag['type'];
                    }

                    if ((string)$tag['description']) {
                        $nArgument['description'] = (string)$tag['description'];
                    }

                    if ((string)$tag['variable']) {
                        $nArgument['name'] = (string)$tag['variable'];
                    }
                }

                $arguments[] = $nArgument;
            }

            $argumentStr = implode(', ', array_map(function($argument) {
                $return = $argument['name'];

                if ($argument['type']) {
                    $return = $argument['type'] . ' ' . $return;
                }

                return $return;
            }, $arguments));

            $signature = sprintf('%s %s::%s(%s)', $return, $className, $methodName, $argumentStr);

            $methods[$methodName] = [
                'name'        => $methodName,
                'description' => (string)$method->docblock->description . "\n\n" . (string)$method->docblock->{'long-description'},
                'visibility'  => (string)$method['visibility'],
                'abstract'    => ((string)$method['abstract']) == "true",
                'static'      => ((string)$method['static']) == "true",
                'deprecated'  => count($class->xpath('docblock/tag[@name="deprecated"]')) > 0,
                'signature'   => $signature,
                'arguments'   => $arguments,
                'definedBy'   => $className,
            ];
        }

        return $methods;
    }
protected function parseMethods ( SimpleXMLElement $ class ) { $ methods = [ ] ; $ className = ( string ) $ class -> full_name ; $ className = ltrim ( $ className , '\\' ) ; foreach ( $ class -> method as $ method ) { $ methodName = ( string ) $ method -> name ; $ return = $ method -> xpath ( 'docblock/tag[@name="return"]' ) ; if ( count ( $ return ) ) { $ return = ( string ) $ return [ 0 ] [ 'type' ] ; } else { $ return = 'mixed' ; } $ arguments = [ ] ; foreach ( $ method -> argument as $ argument ) { $ nArgument = [ 'type' => ( string ) $ argument -> type , 'name' => ( string ) $ argument -> name ] ; $ tags = $ method -> xpath ( sprintf ( 'docblock/tag[@name="param" and @variable="%s"]' , $ nArgument [ 'name' ] ) ) ; if ( count ( $ tags ) ) { $ tag = $ tags [ 0 ] ; if ( ( string ) $ tag [ 'type' ] ) { $ nArgument [ 'type' ] = ( string ) $ tag [ 'type' ] ; } if ( ( string ) $ tag [ 'description' ] ) { $ nArgument [ 'description' ] = ( string ) $ tag [ 'description' ] ; } if ( ( string ) $ tag [ 'variable' ] ) { $ nArgument [ 'name' ] = ( string ) $ tag [ 'variable' ] ; } } $ arguments [ ] = $ nArgument ; } $ argumentStr = implode ( ', ' , array_map ( function ( $ argument ) { $ return = $ argument [ 'name' ] ; if ( $ argument [ 'type' ] ) { $ return = $ argument [ 'type' ] . ' ' . $ return ; } return $ return ; } , $ arguments ) ) ; $ signature = sprintf ( '%s %s::%s(%s)' , $ return , $ className , $ methodName , $ argumentStr ) ; $ methods [ $ methodName ] = [ 'name' => $ methodName , 'description' => ( string ) $ method -> docblock -> description . "\n\n" . ( string ) $ method -> docblock -> { 'long-description' } , 'visibility' => ( string ) $ method [ 'visibility' ] , 'abstract' => ( ( string ) $ method [ 'abstract' ] ) == "true" , 'static' => ( ( string ) $ method [ 'static' ] ) == "true" , 'deprecated' => count ( $ class -> xpath ( 'docblock/tag[@name="deprecated"]' ) ) > 0 , 'signature' => $ signature , 'arguments' => $ arguments , 'definedBy' => $ className , ] ; } return $ methods ; }
Parses all the method information for a single class or interface.

You must pass an xml element that refers to either the class or interface element from
structure.xml.

@param SimpleXMLElement $class

@return array
Parses all the method information for a single class or interface .