Code Duplication    Length = 7-9 lines in 5 locations

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

@@ 21-28 (lines=8) @@
18
        if (isset($_POST['add'])) {
19
            $model = new ItemAddModel();
20
            $id = $model->add($_POST);
21
            if ($id) {
22
                AlertsCollection::add(new Alert(
23
                    'success',
24
                    'Poprawnie dodano!'
25
                ));
26
                $this->redirectTo(DIR.'/admin/appearance/menu/edit/'.$id);
27
                return;
28
            }
29
            AlertsCollection::add(new Alert(
30
                'error',
31
                'Coś się zepsuło!'

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

@@ 19-26 (lines=8) @@
16
        if (isset($_POST['add'])) {
17
            $model = new TypeAddModel();
18
            $id = $model->add($_POST);
19
            if ($id) {
20
                AlertsCollection::add(new Alert(
21
                    'success',
22
                    'Poprawnie dodano!'
23
                ));
24
                $this->redirectTo(DIR.'/admin/appearance/menu/edit-type/'.$id);
25
                return;
26
            }
27
            AlertsCollection::add(new Alert(
28
                'error',
29
                'Coś się zepsuło!'

src/module/Modules/One/Admin/SwitchController.php 1 location

@@ 29-35 (lines=7) @@
26
27
        $status = $configEditor->getStatus($name);
28
29
        if (null === $status) {
30
            AlertsCollection::add(new Alert(
31
                'error',
32
                'Wystąpił nieoczekiwany błąd'
33
            ));
34
            $this->redirect(DIR.'/admin/modules');
35
        }
36
37
        switch ($status) {
38
            case 1:

src/module/Plugins/One/Admin/SwitchController.php 1 location

@@ 23-29 (lines=7) @@
20
21
        $status = $configEditor->getStatus($name);
22
23
        if (null === $status) {
24
            AlertsCollection::add(new Alert(
25
                'error',
26
                'Wystąpił nieoczekiwany błąd'
27
            ));
28
            $this->redirect(DIR.'/admin/plugins');
29
        }
30
31
        switch ($status) {
32
            case 1:

src/module/Users/One/Admin/Profile/AddController.php 1 location

@@ 29-37 (lines=9) @@
26
27
            $id = (new AddModel())->add($_POST);
28
29
            if ($id) {
30
                AlertsCollection::add(
31
                    new Alert(
32
                        'success',
33
                        'Dodano użytkownika'
34
                    )
35
                );
36
                $this->redirect(DIR.'/admin/users/edit/'.$id);
37
            }
38
            AlertsCollection::add(
39
                new Alert(
40
                    'error',