Пример #1
0
 /**
  * Get the current builder output
  *
  * @return string
  */
 public function output()
 {
     $namespace = null;
     $class = $this->name;
     extract(\CCConfig::create('shipyard')->defaults);
     // get namespace from the param
     if (strpos($class, '::') !== false) {
         list($namespace, $class) = explode('::', $this->name);
         // try to get the ship from namespace
         if ($ship = \CCOrbit::ship_by_namespace($namespace)) {
             $package = $ship->name;
             $version = $ship->version;
             $authors = $ship->authors;
         }
     }
     // create forge instance
     $forge = new \CCForge_Php($namespace);
     // add header
     $forge->comment($this->file_header($class, array('package' => $package, 'authors' => $authors, 'version' => $version, 'copyright' => $copyright)));
     $class_string = 'class ' . $class;
     // superclasses
     if ($this->extends) {
         $class_string .= ' extends ' . $this->extends;
     }
     // interface implementations
     if (!empty($this->implements)) {
         $class_string .= ' implements ' . implode(', ', $this->implements);
     }
     // create the closure
     $forge->closure($class_string, $this->output);
     return $forge->buffer;
 }