Code Duplication    Length = 27-27 lines in 2 locations

src/Console/Contracts/GeneratorCommand.php 1 location

@@ 37-63 (lines=27) @@
34
     *
35
     * @return bool|null
36
     */
37
    public function handle()
38
    {
39
        $name = $this->qualifyClass($this->getNameInput());
40
        $path = $this->getPath($name);
41
        // First we will check to see if the class already exists. If it does, we don't want
42
        // to create the class and overwrite the user's code. So, we will bail out so the
43
        // code is untouched. Otherwise, we will continue generating this class' files.
44
        if ((!$this->hasOption('force') ||
45
                !$this->option('force')) &&
46
            $this->alreadyExists($this->getNameInput())
47
        ) {
48
            $this->error($this->type . ' already exists!');
49
50
            return false;
51
        }
52
53
        // Next, we will generate the path to the location where this class' file should get
54
        // written. Then, we will build the class and make the proper replacements on the
55
        // stub files so that it gets the correctly formatted namespace and class name.
56
        $this->makeDirectory($path);
57
58
        $this->files->put($path, $this->buildClass($name));
59
60
        $displayPath = str_replace($this->laravel->basePath(), '', $path);
61
62
        $this->info($this->type . ' created successfully in ' . $displayPath);
63
    }
64
65
    /**
66
     * Parse the class name and format according to the root namespace.

src/Console/Commands/ControllerMakeCommand.php 1 location

@@ 242-268 (lines=27) @@
239
        ];
240
    }
241
242
    public function handle()
243
    {
244
        $name = $this->qualifyClass($this->getNameInput());
245
        $path = $this->getPath($name);
246
        // First we will check to see if the class already exists. If it does, we don't want
247
        // to create the class and overwrite the user's code. So, we will bail out so the
248
        // code is untouched. Otherwise, we will continue generating this class' files.
249
        if ((!$this->hasOption('force') ||
250
                !$this->option('force')) &&
251
            $this->alreadyExists($this->getNameInput())
252
        ) {
253
            $this->error($this->type . ' already exists!');
254
255
            return false;
256
        }
257
258
        // Next, we will generate the path to the location where this class' file should get
259
        // written. Then, we will build the class and make the proper replacements on the
260
        // stub files so that it gets the correctly formatted namespace and class name.
261
        $this->makeDirectory($path);
262
263
        $displayPath = str_replace($this->laravel['path'], '/app', $path);
264
265
        $this->files->put($path, $this->buildClass($name));
266
267
        $this->info($this->type . ' created successfully in ' . $displayPath);
268
    }
269
}
270