getClassNamespace() публичный Метод

public getClassNamespace ( )
Пример #1
0
 private function generate()
 {
     $controller = $this->input->getArgument('controller');
     $action = $this->input->getArgument('action');
     $controllerGenerator = new ControllerGenerator($controller);
     $actionGenerator = null;
     if ($action) {
         $actionGenerator = new ActionGenerator($action);
     }
     $this->output->writeln('---------------------------------');
     $this->output->writeln('Class name: <info>' . $controllerGenerator->getClassName() . '</info>');
     $this->output->writeln('Class namespace: <info>' . $controllerGenerator->getClassNamespace() . '</info>');
     $this->output->writeln('---------------------------------');
     if (!$controllerGenerator->isControllerExists()) {
         $this->output->writeln('Create: <info>' . $controllerGenerator->getControllerPath() . '</info>');
         $controllerGenerator->saveController();
     }
     if ($controllerGenerator->appendAction($actionGenerator)) {
         $this->output->writeln('Appened action: <info>' . $controllerGenerator->getClassName() . '::' . $actionGenerator->getActionName() . '</info>');
     }
     $viewGenerator = new ViewGenerator($controller);
     if ($viewGenerator->createViewDirectoryIfNotExists()) {
         $this->output->writeln('Create: <info>' . $viewGenerator->getViewPath() . '</info>');
     }
     if ($viewGenerator->appendAction($actionGenerator)) {
         $this->output->writeln('Appened view file: <info>' . $actionGenerator->getActionViewFile() . '</info>');
     }
 }
Пример #2
0
 /**
  * @test
  */
 public function shouldReturnClassNamespace()
 {
     //given
     $generator = new ControllerGenerator('users');
     //when
     $classNamespace = $generator->getClassNamespace();
     //then
     $this->assertEquals('\\Application\\Controller', $classNamespace);
 }
 public function content()
 {
     $stubContent = file_get_contents($this->stubFilePath());
     $strSubstitutor = new StrSubstitutor(array('namespace' => $this->generator->getClassNamespace(), 'class' => $this->generator->getClassName()));
     return $strSubstitutor->replace($stubContent);
 }