Code Duplication    Length = 10-12 lines in 2 locations

app/Http/Controllers/Common/SettingsController.php 2 locations

@@ 338-347 (lines=10) @@
335
            return redirect()->back()->with('success', 'Status has changed');
336
        }
337
        $status = $plug->status;
338
        if ($status == 0) {
339
            $plug->status = 1;
340
341
            $app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
342
            $str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
343
            $line_i_am_looking_for = 102;
344
            $lines = file($app, FILE_IGNORE_NEW_LINES);
345
            $lines[$line_i_am_looking_for] = $str;
346
            file_put_contents($app, implode("\n", $lines));
347
        }
348
        if ($status == 1) {
349
            $plug->status = 0;
350
            /*
@@ 348-359 (lines=12) @@
345
            $lines[$line_i_am_looking_for] = $str;
346
            file_put_contents($app, implode("\n", $lines));
347
        }
348
        if ($status == 1) {
349
            $plug->status = 0;
350
            /*
351
             * remove service provider from app.php
352
             */
353
            $str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
354
            $path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
355
356
            $file_contents = file_get_contents($path_to_file);
357
            $file_contents = str_replace($str, '//', $file_contents);
358
            file_put_contents($path_to_file, $file_contents);
359
        }
360
        $plug->save();
361
362
        return redirect()->back()->with('success', 'Status has changed');