Code Duplication    Length = 20-20 lines in 2 locations

src/Http/Controller/Admin/AddonsController.php 2 locations

@@ 81-100 (lines=20) @@
78
     * @param                                    $addon
79
     * @return \Illuminate\Http\RedirectResponse
80
     */
81
    public function install(
82
        Request $request,
83
        ModuleManager $modules,
84
        AddonCollection $addons,
85
        ExtensionManager $extensions,
86
        $addon
87
    ) {
88
        /* @var Addon|Module|Extension $addon */
89
        $addon = $addons->get($addon);
90
91
        if ($addon instanceof Module) {
92
            $modules->install($addon, filter_var($request->input('seed'), FILTER_VALIDATE_BOOLEAN));
93
        } elseif ($addon instanceof Extension) {
94
            $extensions->install($addon, filter_var($request->input('seed'), FILTER_VALIDATE_BOOLEAN));
95
        }
96
97
        $this->messages->success('module::message.install_addon_success');
98
99
        return $this->redirect->back();
100
    }
101
102
    /**
103
     * Migrate an addon.
@@ 112-131 (lines=20) @@
109
     * @param                                    $addon
110
     * @return \Illuminate\Http\RedirectResponse
111
     */
112
    public function migrate(
113
        Request $request,
114
        ModuleManager $modules,
115
        AddonCollection $addons,
116
        ExtensionManager $extensions,
117
        $addon
118
    ) {
119
        /* @var Addon|Module|Extension $addon */
120
        $addon = $addons->get($addon);
121
122
        if ($addon instanceof Module) {
123
            $modules->migrate($addon, filter_var($request->input('seed'), FILTER_VALIDATE_BOOLEAN));
124
        } elseif ($addon instanceof Extension) {
125
            $extensions->migrate($addon, filter_var($request->input('seed'), FILTER_VALIDATE_BOOLEAN));
126
        }
127
128
        $this->messages->success('module::message.migrate_addon_success');
129
130
        return $this->redirect->back();
131
    }
132
133
    /**
134
     * Uninstall an addon.