protected function parseMethod(ClassBuilder $classBuilder, NodeStream $stream)
    {
        $builder = new MethodBuilder();
        $comments = array();
        $methodNodes = array(
            TokenParser::NODE_PUBLIC_METHOD => 'public',
            TokenParser::NODE_PROTECTED_METHOD => 'protected',
            TokenParser::NODE_PRIVATE_METHOD => 'private'
        );

        $node = $stream->expect(array_keys($methodNodes));
        $builder->setName($node->getValue());
        $builder->setVisibility($methodNodes[$node->getType()]);

        while ($stream->is(TokenParser::NODE_ARGUMENT)) {
            $argument = array();
            $argument[] = $stream->current()->getValue();
            $stream->next();
            if ($stream->is(TokenParser::NODE_ARGUMENT_TYPE)) {
                $argument[] = $stream->current()->getValue();
                $stream->next();
            } else {
                $argument[] = 'mixed';
            }
            $builder->addArgument($argument);
        }

        if ($stream->is(TokenParser::NODE_RETURN_TYPE)) {
            $builder->setType($stream->current()->getValue());
            $stream->next();
        }

        while ($stream->is(TokenParser::NODE_METHOD_COMMENT)) {
            $comments[] = $stream->current()->getValue();
            $stream->next();
        }

        if (count($comments) > 0) {
            $builder->setComments($comments);
        }

        $classBuilder->addMethod($builder);
    }
protected function parseMethod(ClassBuilder $classBuilder, NodeStream $stream)
    {
        $builder = new MethodBuilder();
        $comments = array();
        $methodNodes = array(
            TokenParser::NODE_PUBLIC_METHOD => 'public',
            TokenParser::NODE_PROTECTED_METHOD => 'protected',
            TokenParser::NODE_PRIVATE_METHOD => 'private'
        );

        $node = $stream->expect(array_keys($methodNodes));
        $builder->setName($node->getValue());
        $builder->setVisibility($methodNodes[$node->getType()]);

        while ($stream->is(TokenParser::NODE_ARGUMENT)) {
            $argument = array();
            $argument[] = $stream->current()->getValue();
            $stream->next();
            if ($stream->is(TokenParser::NODE_ARGUMENT_TYPE)) {
                $argument[] = $stream->current()->getValue();
                $stream->next();
            } else {
                $argument[] = 'mixed';
            }
            $builder->addArgument($argument);
        }

        if ($stream->is(TokenParser::NODE_RETURN_TYPE)) {
            $builder->setType($stream->current()->getValue());
            $stream->next();
        }

        while ($stream->is(TokenParser::NODE_METHOD_COMMENT)) {
            $comments[] = $stream->current()->getValue();
            $stream->next();
        }

        if (count($comments) > 0) {
            $builder->setComments($comments);
        }

        $classBuilder->addMethod($builder);
    }
protected function parseMethod ( ClassBuilder $ classBuilder , NodeStream $ stream ) { $ builder = new MethodBuilder ( ) ; $ comments = array ( ) ; $ methodNodes = array ( TokenParser :: NODE_PUBLIC_METHOD => 'public' , TokenParser :: NODE_PROTECTED_METHOD => 'protected' , TokenParser :: NODE_PRIVATE_METHOD => 'private' ) ; $ node = $ stream -> expect ( array_keys ( $ methodNodes ) ) ; $ builder -> setName ( $ node -> getValue ( ) ) ; $ builder -> setVisibility ( $ methodNodes [ $ node -> getType ( ) ] ) ; while ( $ stream -> is ( TokenParser :: NODE_ARGUMENT ) ) { $ argument = array ( ) ; $ argument [ ] = $ stream -> current ( ) -> getValue ( ) ; $ stream -> next ( ) ; if ( $ stream -> is ( TokenParser :: NODE_ARGUMENT_TYPE ) ) { $ argument [ ] = $ stream -> current ( ) -> getValue ( ) ; $ stream -> next ( ) ; } else { $ argument [ ] = 'mixed' ; } $ builder -> addArgument ( $ argument ) ; } if ( $ stream -> is ( TokenParser :: NODE_RETURN_TYPE ) ) { $ builder -> setType ( $ stream -> current ( ) -> getValue ( ) ) ; $ stream -> next ( ) ; } while ( $ stream -> is ( TokenParser :: NODE_METHOD_COMMENT ) ) { $ comments [ ] = $ stream -> current ( ) -> getValue ( ) ; $ stream -> next ( ) ; } if ( count ( $ comments ) > 0 ) { $ builder -> setComments ( $ comments ) ; } $ classBuilder -> addMethod ( $ builder ) ; }
Parses method nodes

@param ClassBuilder $classBuilder ClassBuilder object
@param NodeStream   $stream       NodeStream object
Parses method nodes