| Conditions | 3 | 
| Paths | 3 | 
| Total Lines | 21 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 16 | public function del($id)  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 17 |     { | 
            ||
| 18 |         if (isset($_POST['delete'])) { | 
            ||
| 19 |             if ((new DelModel())->del($id)) { | 
            ||
| 20 | AlertsCollection::add(new Alert(  | 
            ||
| 21 | 'success',  | 
            ||
| 22 | 'Poprawnie usunięto użytkownika'  | 
            ||
| 23 | ));  | 
            ||
| 24 | $this->redirect(DIR.'/admin/users');  | 
            ||
| 25 |             } else { | 
            ||
| 26 | AlertsCollection::add(new Alert(  | 
            ||
| 27 | 'error',  | 
            ||
| 28 | 'Wystąpił nieoczekiwany błąd'  | 
            ||
| 29 | ));  | 
            ||
| 30 | }  | 
            ||
| 31 | }  | 
            ||
| 32 | |||
| 33 | $view = new DelView();  | 
            ||
| 34 | $view->display((new EditModel())->getUserInfoById($id));  | 
            ||
| 35 | $view->render();  | 
            ||
| 36 | }  | 
            ||
| 37 | }  | 
            ||
| 38 | 
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: