Conditions | 3 |
Paths | 6 |
Total Lines | 24 |
Lines | 24 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
30 | View Code Duplication | public function handle() |
|
|
|||
31 | { |
||
32 | $part = Str::slug($this->argument('part')); |
||
33 | |||
34 | $lockFilename = 'framework/partial-down-'.$part; |
||
35 | |||
36 | try { |
||
37 | if (! file_exists(storage_path($lockFilename))) { |
||
38 | $this->comment("This part [{$part}] of the application is already up."); |
||
39 | |||
40 | return true; |
||
41 | } |
||
42 | |||
43 | unlink(storage_path($lockFilename)); |
||
44 | |||
45 | $this->info("This part [{$part}] of the application is now live."); |
||
46 | } catch (Exception $e) { |
||
47 | $this->error("Failed to disable maintenance mode for this part [{$part}] of the application."); |
||
48 | |||
49 | $this->error($e->getMessage()); |
||
50 | |||
51 | return 1; |
||
52 | } |
||
53 | } |
||
54 | } |
||
55 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.