/** * 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)); } }
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); }
/** * 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']); } }