public function compile(ClassBuilder $builder)
    {
        $writer = new StreamWriter($this->options);
        $writer->writeLine('<?php');
        $writer->writeLine();

        $this->compileClassDefinition($builder, $writer);
        $this->compilePropertyDefinitions($builder, $writer);
        $this->compileMethodDefinitions($builder, $writer);

        $writer->writeLine('}');

        return $writer;
    }