Code Duplication    Length = 15-15 lines in 2 locations

src/Http/Controllers/UtilitiesController.php 2 locations

@@ 79-93 (lines=15) @@
76
     * @param string $task
77
     * @return \Illuminate\Http\JsonResponse
78
     */
79
    public function backup($task = 'run')
80
    {
81
        if (! in_array($task, ['backup', 'clean'])) {
82
            $message = trans('cms::utilities.backup.not_allowed',['task'=>$task]). trans('cms::utilities.field.executed_by',['name'=>$this->getCurrentUserName()]);
83
            $this->log->info($message);
84
85
            return $this->notifyError($message);
86
        }
87
88
        $this->command->call('backup:' . $task);
89
        $message = $task == 'clean' ? trans('cms::utilities.backup.cleanup_complete') : trans('cms::utilities.backup.complete');
90
        $this->log->info($message . trans('cms::utilities.field.executed_by',['name'=>$this->getCurrentUserName()]));
91
92
        return $this->notifySuccess($message);
93
    }
94
95
    /**
96
     * Get name of the current user.
@@ 124-138 (lines=15) @@
121
     * @param string $task
122
     * @return \Illuminate\Http\JsonResponse
123
     */
124
    public function config($task)
125
    {
126
        if (! in_array($task, ['cache', 'clear'])) {
127
            $message = trans('cms::utilities.config.not_allowed',['task'=>$task]). trans('cms::utilities.field.executed_by',['name'=>$this->getCurrentUserName()]);
128
            $this->log->info($message);
129
130
            return $this->notifyError($message);
131
        }
132
133
        $message = $task == 'cache' ? trans('cms::utilities.config.cache') : trans('cms::utilities.config.cache_cleared');
134
        $this->log->info($message . trans('cms::utilities.field.executed_by',['name'=>$this->getCurrentUserName()]));
135
        $this->command->call('config:' . $task);
136
137
        return $this->notifySuccess($message);
138
    }
139
140
    /**
141
     * Clear views manually.