Code Duplication    Length = 19-19 lines in 2 locations

src/Console/ControllerCreate.php 1 location

@@ 27-45 (lines=19) @@
24
        $this->addArgument('name', InputArgument::REQUIRED);
25
    }
26
27
    public function execute(InputInterface $input, OutputInterface $output)
28
    {
29
        $controllerPath = app()->getPath() . '/src/Controller';
30
        if (!file_exists($controllerPath)) {
31
            mkdir($controllerPath, 0755, true);
32
        }
33
34
        $name = ucfirst($input->getArgument('name')) . 'Controller';
35
        $content = $this->createControllerTemplate($name);
36
37
        $controllerFile = $controllerPath . '/' . $name . '.php';
38
39
        if (file_exists($controllerFile)) {
40
            throw new \LogicException(sprintf('Controller %s is already exists', $name));
41
        }
42
43
        file_put_contents($controllerFile, $content);
44
        $output->writeln(sprintf('Controller %s created successful. path in %s', $name, $controllerPath));
45
    }
46
47
    public function createControllerTemplate($name)
48
    {

src/Console/ModelCreate.php 1 location

@@ 30-48 (lines=19) @@
27
        $this->addArgument('name', InputArgument::REQUIRED);
28
    }
29
30
    public function execute(InputInterface $input, OutputInterface $output)
31
    {
32
        $modelPath = app()->getPath() . '/src/Model';
33
        if (!file_exists($modelPath)) {
34
            mkdir($modelPath, 0755, true);
35
        }
36
37
        $name = ucfirst($input->getArgument('name')) . 'Model';
38
        $content = $this->createModelTemplate($name);
39
40
        $modelFile = $modelPath . '/' . $name . '.php';
41
42
        if (file_exists($modelFile)) {
43
            throw new \LogicException(sprintf('Model %s is already exists', $name));
44
        }
45
46
        file_put_contents($modelFile, $content);
47
        $output->writeln(sprintf('Model %s created successful. path in %s', $name, $modelPath));
48
    }
49
50
    protected function createModelTemplate($name)
51
    {