protected function execute(InputInterface $input, OutputInterface $output) { $this->controllerName = $input->getArgument('controllerName'); $this->methods = $input->getArgument('methods'); $error = null; if (in_array($this->controllerName, ReservedWords::getList())) { $output->writeln("<error>Controller name cannot be a reserved word</>"); $error = true; } if (is_array($this->methods)) { foreach ($this->methods as $method) { if (in_array($method, ReservedWords::getList())) { $output->writeln("<error>Method name ({$method}) cannot be a reserved word</>"); $error = true; } } } if ($error == true) { exit; } if (!is_dir("app/Views/" . ucwords($this->controllerName))) { mkdir("app/Views/" . ucwords($this->controllerName)); } $this->makeViews(); $this->makeRoutes(); $this->makeController(); $output->writeln("<info>Controller " . $this->controllerName . " created with " . count($this->methods) . " methods</>"); }
protected function execute(InputInterface $input, OutputInterface $output) { $this->modelName = $input->getArgument('modelName'); $this->methods = $input->getArgument('methods'); $error = null; if (in_array($this->modelName, ReservedWords::getList())) { $output->writeln("<error>Model name cannot be a reserved word</>"); $error = true; } if (is_array($this->methods)) { foreach ($this->methods as $method) { if (in_array($method, ReservedWords::getList())) { $output->writeln("<error>Method name ({$method}) cannot be a reserved word</>"); $error = true; } } } if ($error == true) { exit; } $this->makeModel(); $output->writeln("<info>Model " . $this->modelName . " created with " . count($this->methods) . " methods</>"); }