| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 16 |
| Lines | 8 |
| Ratio | 34.78 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function del($id) |
||
|
|
|||
| 17 | { |
||
| 18 | if (isset($_POST['delete'])) { |
||
| 19 | $model = new DelModel(); |
||
| 20 | View Code Duplication | if ($model->del($id)) { |
|
| 21 | AlertsCollection::add(new Alert( |
||
| 22 | 'success', |
||
| 23 | 'Poprawnie usunięto!' |
||
| 24 | )); |
||
| 25 | $this->redirectTo(DIR.'/admin/appearance/menu'); |
||
| 26 | return; |
||
| 27 | } |
||
| 28 | AlertsCollection::add(new Alert( |
||
| 29 | 'success', |
||
| 30 | 'Coś się zepsuło!' |
||
| 31 | )); |
||
| 32 | $this->redirectTo(DIR.'/admin/appearance/menu/del/'.$id); |
||
| 33 | } |
||
| 34 | |||
| 35 | $view = new DelView(); |
||
| 36 | $view->display((new EditModel())->getInfo($id)); |
||
| 37 | $view->render('admin'); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: