AddController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A add() 0 23 4
1
<?php
2
3
namespace Rudolf\Modules\Galleries\One\Admin;
4
5
use Rudolf\Framework\Controller\AdminController;
6
7
class AddController extends AdminController
8
{
9
    /**
10
     * @throws \Exception
11
     */
12
    public function add()
13
    {
14
        $model = new AddModel();
15
16
        $form = new AddForm();
17
        $form->setModel($model);
18
19
        // if data was send
20
        if (!empty($_POST)) {
21
            $form->handle($_POST);
22
23
            if ($form->isValid() && $id = $form->add()) {
24
                $model->flushCache('galleries');
25
                $this->redirect(DIR.'/admin/galleries/edit/'.$id);
26
            }
27
28
            $form->displayAlerts();
29
        }
30
31
        $view = new AddView();
32
        $view->addGallery($form->getDataToDisplay());
33
        $view->render();
34
    }
35
}
36