protected function execute(InputInterface $input, OutputInterface $output)
 {
     $module = ucfirst($input->getArgument('module'));
     $controller = $input->getArgument('controller');
     if (!empty($controller)) {
         $controller = ucfirst($controller);
     } else {
         $controller = $module;
     }
     $controller .= 'PageController';
     $filename = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR;
     $filename .= 'page_controller.php.twig';
     if (file_exists($filename)) {
         $string = new TString(file_get_contents($filename));
         $string->replace('{{ controller }}', $controller)->replace('{{ module }}', $module)->replace('{{ date }}', date('d/m/Y'));
     } else {
         throw new FileNotFoundException("{$filename} nao encontrado");
     }
     $fileController = $this->modulesPath . $module . DIRECTORY_SEPARATOR . 'Controller' . DIRECTORY_SEPARATOR . $controller . '.php';
     if (file_exists($this->modulesPath . $module)) {
         Filesystem::getInstance()->touch($fileController);
         Filesystem::getInstance()->chmod($fileController, 0660);
         $file = new File($fileController);
         $fileObject = $file->openFile('w');
         $fileObject->fwrite($string->getValue());
         $output->writeln("<info>OK: {$fileController} criado com sucesso</info>");
     } else {
         $output->writeln("<error>FALHA: O módulo {$module} não existe ou não é gravável</error>");
     }
 }
Esempio n. 2
0
 /**
  * Retorna um novo flutuador inicializada com o valor representado por o especificado
  *  String, como é realizada pelo método valueOf da classe Float.
  * @param \Prime\Core\TString $string
  * @return \Prime\core\TFloat
  */
 public static function parseFloat(TString $string)
 {
     return new TFloat($string->getValue());
 }
Esempio n. 3
0
 /**
  * Concatena a seqüência especificada para o final desta string.
  * @param string $str
  * @return TString
  */
 public function concat($str)
 {
     if (!$str instanceof TString) {
         $str = new TString((string) $str);
     }
     $this->setValue($this->getValue() . $str->getValue());
     return $this;
 }