protected function compileMethodDefinitions(ClassBuilder $builder, StreamWriter $writer)
    {

        foreach ($builder->getMethods() as $method) {
            /* @var MethodBuilder $method */

            $writer->indent()->writeLine('/**');

            $comments = $method->getComments();
            if (count($comments)) {
                foreach ($comments as $comment) {
                    $comment = trim(ltrim($comment, '>'));
                    $writer->indent()->write(' * ')->writeLine($comment);
                }
                $writer->indent()->write(' * ')->writeLine();
            }

            $arguments = $method->getArguments();
            $argumentTypeMaxLen = 0;
            if (count($arguments)) {
                foreach ($arguments as $argument) {
                    $argumentTypeMaxLen = max($argumentTypeMaxLen, strlen($argument[1]));
                }
            }

            foreach ($arguments as $argument) {
                $writer->indent()
                    ->write(' * @param ' . sprintf('%-' . $argumentTypeMaxLen . 's', $argument[1]))
                    ->writeLine(' $' . $argument[0]);
            }

            if ($method->getType()) {
                $writer->indent()->writeLine(' *');
                $writer->indent()->writeLine(' * @return ' . $method->getType());
            }

            $writer->indent()->writeLine(' */');

            $writer->indent()
                ->write($method->getVisibility())
                ->write(' function ')
                ->write($method->getName())
                ->write('(');

            $args = array();
            foreach ($arguments as $argument) {
                $type = $this->getType($argument[1]);
                $item = '';
                if ($type['hint']) {
                    $item .= $type['name'] . ' ';
                }
                $item .= '$'.$argument[0];
                $args[] = $item;
            }

            if (count($args)) {
                $writer->write(implode(', ', $args));
            }

            $writer->writeLine(')')
                ->indent()->writeLine('{')
                ->indent()->indent()->writeLine()
                ->indent()->writeLine('}')->writeLine();
        }
    }
protected function compileMethodDefinitions(ClassBuilder $builder, StreamWriter $writer)
    {

        foreach ($builder->getMethods() as $method) {
            /* @var MethodBuilder $method */

            $writer->indent()->writeLine('/**');

            $comments = $method->getComments();
            if (count($comments)) {
                foreach ($comments as $comment) {
                    $comment = trim(ltrim($comment, '>'));
                    $writer->indent()->write(' * ')->writeLine($comment);
                }
                $writer->indent()->write(' * ')->writeLine();
            }

            $arguments = $method->getArguments();
            $argumentTypeMaxLen = 0;
            if (count($arguments)) {
                foreach ($arguments as $argument) {
                    $argumentTypeMaxLen = max($argumentTypeMaxLen, strlen($argument[1]));
                }
            }

            foreach ($arguments as $argument) {
                $writer->indent()
                    ->write(' * @param ' . sprintf('%-' . $argumentTypeMaxLen . 's', $argument[1]))
                    ->writeLine(' $' . $argument[0]);
            }

            if ($method->getType()) {
                $writer->indent()->writeLine(' *');
                $writer->indent()->writeLine(' * @return ' . $method->getType());
            }

            $writer->indent()->writeLine(' */');

            $writer->indent()
                ->write($method->getVisibility())
                ->write(' function ')
                ->write($method->getName())
                ->write('(');

            $args = array();
            foreach ($arguments as $argument) {
                $type = $this->getType($argument[1]);
                $item = '';
                if ($type['hint']) {
                    $item .= $type['name'] . ' ';
                }
                $item .= '$'.$argument[0];
                $args[] = $item;
            }

            if (count($args)) {
                $writer->write(implode(', ', $args));
            }

            $writer->writeLine(')')
                ->indent()->writeLine('{')
                ->indent()->indent()->writeLine()
                ->indent()->writeLine('}')->writeLine();
        }
    }
protected function compileMethodDefinitions ( ClassBuilder $ builder , StreamWriter $ writer ) { foreach ( $ builder -> getMethods ( ) as $ method ) { /* @var MethodBuilder $method */ $ writer -> indent ( ) -> writeLine ( '/**' ) ; $ comments = $ method -> getComments ( ) ; if ( count ( $ comments ) ) { foreach ( $ comments as $ comment ) { $ comment = trim ( ltrim ( $ comment , '>' ) ) ; $ writer -> indent ( ) -> write ( ' * ' ) -> writeLine ( $ comment ) ; } $ writer -> indent ( ) -> write ( ' * ' ) -> writeLine ( ) ; } $ arguments = $ method -> getArguments ( ) ; $ argumentTypeMaxLen = 0 ; if ( count ( $ arguments ) ) { foreach ( $ arguments as $ argument ) { $ argumentTypeMaxLen = max ( $ argumentTypeMaxLen , strlen ( $ argument [ 1 ] ) ) ; } } foreach ( $ arguments as $ argument ) { $ writer -> indent ( ) -> write ( ' * @param ' . sprintf ( '%-' . $ argumentTypeMaxLen . 's' , $ argument [ 1 ] ) ) -> writeLine ( ' $' . $ argument [ 0 ] ) ; } if ( $ method -> getType ( ) ) { $ writer -> indent ( ) -> writeLine ( ' *' ) ; $ writer -> indent ( ) -> writeLine ( ' * @return ' . $ method -> getType ( ) ) ; } $ writer -> indent ( ) -> writeLine ( ' */' ) ; $ writer -> indent ( ) -> write ( $ method -> getVisibility ( ) ) -> write ( ' function ' ) -> write ( $ method -> getName ( ) ) -> write ( '(' ) ; $ args = array ( ) ; foreach ( $ arguments as $ argument ) { $ type = $ this -> getType ( $ argument [ 1 ] ) ; $ item = '' ; if ( $ type [ 'hint' ] ) { $ item .= $ type [ 'name' ] . ' ' ; } $ item .= '$' . $ argument [ 0 ] ; $ args [ ] = $ item ; } if ( count ( $ args ) ) { $ writer -> write ( implode ( ', ' , $ args ) ) ; } $ writer -> writeLine ( ')' ) -> indent ( ) -> writeLine ( '{' ) -> indent ( ) -> indent ( ) -> writeLine ( ) -> indent ( ) -> writeLine ( '}' ) -> writeLine ( ) ; } }
Compiles method definition

@param ClassBuilder $builder
@param StreamWriter $writer
Compiles method definition