Example #1
0
 public function to_php()
 {
     $php = '';
     if ($this->is_final()) {
         $php .= 'final ';
     }
     if ($this->is_abstract()) {
         $php .= 'abstract ';
     }
     $php .= "class {$this->name}";
     if ($this->superclass) {
         $php .= " extends {$this->superclass}";
     }
     if (!empty($this->interfaces)) {
         $php .= " implements " . implode(', ', $this->interfaces);
     }
     $php .= " {\n";
     foreach ($this->chunks as $chunk) {
         if ($chunk === null) {
             continue;
         }
         $php .= $chunk->to_php() . "\n";
     }
     $php .= "}\n";
     if ($this->has_annotation()) {
         $php .= Annotation::export_class_annotation($this) . "\n";
     }
     foreach ($this->methods() as $method) {
         if ($method->has_annotation()) {
             $php .= Annotation::export_method_annotation($this, $method) . "\n";
         }
     }
     foreach ($this->variables() as $variable) {
         if ($variable->has_annotation()) {
             $php .= Annotation::export_variable_annotation($this, $variable) . "\n";
         }
     }
     return $php;
 }