示例#1
0
 /**
  * Write classes
  */
 public function write()
 {
     foreach ($this->objects as $className => $classContent) {
         $className = Format::className($className);
         Message::write(sprintf(Message::$classTemplate, $className));
         $fileName = "{$this->directory}/{$className}.php";
         if (file_exists($fileName)) {
             unlink($fileName);
         }
         $file = new \SplFileObject($fileName, 'w');
         $file->fwrite(html_entity_decode($classContent));
     }
 }
示例#2
0
 public function run(array $args)
 {
     Message::write(Message::$startTemplate);
     $this->handleArgs($args);
     $this->handleOptions($args);
     Message::write(Message::$loadingTemplate);
     $loader = new Loader($this->arguments['json'], $this->options);
     $objects = $loader->load();
     Message::write(Message::$writingTemplate);
     $writer = new Writer($this->arguments['directory'], $objects);
     $writer->write();
     Message::write(Message::$thanksTemplate);
 }
示例#3
0
 /**
  * Bind loaded classes
  */
 protected function bindClasses()
 {
     foreach ($this->objects as $object => $value) {
         Message::write(sprintf(Message::$classTemplate, Format::className($object)));
         $this->classes[$object] = sprintf(Classes::getTemplate(), $this->options['--namespace'], $this->objects[$object]['use'], ucfirst($object), $this->objects[$object]['arguments'], $this->objects[$object]['methods']);
     }
 }