Code Duplication    Length = 14-15 lines in 2 locations

src/module/Appearance/Menu/Item/ItemEditController.php 1 location

@@ 23-37 (lines=15) @@
20
        $model = new ItemEditModel();
21
        $view  = new ItemEditView();
22
23
        if (isset($_POST['update'])) {
24
            if ($model->edit($id, $_POST)) {
25
                AlertsCollection::add(new Alert(
26
                    'success',
27
                    'Zaktualizowano!'
28
                ));
29
                $this->redirectTo(DIR.'/admin/appearance/menu/edit-item/'.$id);
30
31
                return;
32
            }
33
            AlertsCollection::add(new Alert(
34
                'error',
35
                'Coś się zepsuło!'
36
            ));
37
        }
38
39
        $view->display($model->getInfo($id), (new Model())->getTypes(), (new FrontModel())->getMenuItems());
40
        $view->render();

src/module/Appearance/Menu/Type/TypeEditController.php 1 location

@@ 21-34 (lines=14) @@
18
        $model = new TypeEditModel();
19
        $view = new TypeEditView();
20
21
        if (isset($_POST['update'])) {
22
            if ($model->edit($id, $_POST)) {
23
                AlertsCollection::add(new Alert(
24
                    'success',
25
                    'Zaktualizowano!'
26
                ));
27
                $this->redirectTo(DIR.'/admin/appearance/menu/edit-type/'.$id);
28
                return;
29
            }
30
            AlertsCollection::add(new Alert(
31
                'error',
32
                'Coś się zepsuło!'
33
            ));
34
        }
35
36
        $view->display($model->getMenuTypeById($id));
37
        $view->render();