| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function postAddAction() |
||
|
|
|||
| 17 | { |
||
| 18 | $model = new ExamAddModel($this->get('dbh')); |
||
| 19 | |||
| 20 | if ($id = $model->add($_POST)) { |
||
| 21 | $this->redirectWithMessage('/admin/test/edit/'.$id, 'success', 'Dodano pomyślnie'); |
||
| 22 | } else { |
||
| 23 | $this->redirectWithMessage('/admin/test/add', 'warning', 'Coś się zepsuło'); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | } |
||
| 27 |
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: