protected function compileClassDefinition(ClassBuilder $builder, StreamWriter $writer)
    {
        $namespace = null;
        $class = $this->parseClassName($builder->getClass());
        if ($class['namespace']) {
            $namespace = $class['namespace'];
            $writer->writeLineF('namespace %s;', trim(ltrim($namespace, '\\')));
            $writer->writeLine();
        }

        $docblock = $builder->getDocblock();
        if ($docblock) {
            $writer->writeLine('/**');
            foreach ($docblock as $docline) {
                $docline = trim(ltrim($docline, '>'));
                $writer->writeLine(' * ' . $docline);
            }
            $writer->writeLine(' */');
        }

        $writer->writeF('class %s', $class['classname']);

        if ($extends = $builder->getExtends()) {
            $extends = $this->parseClassName($extends);
            if ($extends['namespace'] == $namespace) {
                $writer->writeF(' extends %s', $extends['classname']);
            } else {
                $writer->writeF(' extends %s', $extends['fqcn']);
            }
        }

        $interfaces = $builder->getInterfaces();
        if (count($interfaces)) {
            $writer->write(' implements ');
            $implements = array();
            foreach ($interfaces as $interface) {
                $interface = $this->parseClassName($interface);
                if ($interface['namespace'] == $namespace) {
                    $implements[] = $interface['classname'];
                } else {
                    $implements[] = $interface['fqcn'];
                }
            }
            $writer->write(implode(', ', $implements));
        }

        $writer->writeLine(' {');
        $writer->writeLine();
    }
protected function compileClassDefinition(ClassBuilder $builder, StreamWriter $writer)
    {
        $namespace = null;
        $class = $this->parseClassName($builder->getClass());
        if ($class['namespace']) {
            $namespace = $class['namespace'];
            $writer->writeLineF('namespace %s;', trim(ltrim($namespace, '\\')));
            $writer->writeLine();
        }

        $docblock = $builder->getDocblock();
        if ($docblock) {
            $writer->writeLine('/**');
            foreach ($docblock as $docline) {
                $docline = trim(ltrim($docline, '>'));
                $writer->writeLine(' * ' . $docline);
            }
            $writer->writeLine(' */');
        }

        $writer->writeF('class %s', $class['classname']);

        if ($extends = $builder->getExtends()) {
            $extends = $this->parseClassName($extends);
            if ($extends['namespace'] == $namespace) {
                $writer->writeF(' extends %s', $extends['classname']);
            } else {
                $writer->writeF(' extends %s', $extends['fqcn']);
            }
        }

        $interfaces = $builder->getInterfaces();
        if (count($interfaces)) {
            $writer->write(' implements ');
            $implements = array();
            foreach ($interfaces as $interface) {
                $interface = $this->parseClassName($interface);
                if ($interface['namespace'] == $namespace) {
                    $implements[] = $interface['classname'];
                } else {
                    $implements[] = $interface['fqcn'];
                }
            }
            $writer->write(implode(', ', $implements));
        }

        $writer->writeLine(' {');
        $writer->writeLine();
    }
protected function compileClassDefinition ( ClassBuilder $ builder , StreamWriter $ writer ) { $ namespace = null ; $ class = $ this -> parseClassName ( $ builder -> getClass ( ) ) ; if ( $ class [ 'namespace' ] ) { $ namespace = $ class [ 'namespace' ] ; $ writer -> writeLineF ( 'namespace %s;' , trim ( ltrim ( $ namespace , '\\' ) ) ) ; $ writer -> writeLine ( ) ; } $ docblock = $ builder -> getDocblock ( ) ; if ( $ docblock ) { $ writer -> writeLine ( '/**' ) ; foreach ( $ docblock as $ docline ) { $ docline = trim ( ltrim ( $ docline , '>' ) ) ; $ writer -> writeLine ( ' * ' . $ docline ) ; } $ writer -> writeLine ( ' */' ) ; } $ writer -> writeF ( 'class %s' , $ class [ 'classname' ] ) ; if ( $ extends = $ builder -> getExtends ( ) ) { $ extends = $ this -> parseClassName ( $ extends ) ; if ( $ extends [ 'namespace' ] == $ namespace ) { $ writer -> writeF ( ' extends %s' , $ extends [ 'classname' ] ) ; } else { $ writer -> writeF ( ' extends %s' , $ extends [ 'fqcn' ] ) ; } } $ interfaces = $ builder -> getInterfaces ( ) ; if ( count ( $ interfaces ) ) { $ writer -> write ( ' implements ' ) ; $ implements = array ( ) ; foreach ( $ interfaces as $ interface ) { $ interface = $ this -> parseClassName ( $ interface ) ; if ( $ interface [ 'namespace' ] == $ namespace ) { $ implements [ ] = $ interface [ 'classname' ] ; } else { $ implements [ ] = $ interface [ 'fqcn' ] ; } } $ writer -> write ( implode ( ', ' , $ implements ) ) ; } $ writer -> writeLine ( ' {' ) ; $ writer -> writeLine ( ) ; }
Compiles class definition

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