| Conditions | 4 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | public function add() |
||
| 41 | { |
||
| 42 | $errors = []; |
||
| 43 | if ($this->getRequest()->is('post')) { |
||
| 44 | if ($this->JiraForm->execute($this->getRequest()->getData())) { |
||
| 45 | $this->Flash->success(__('The {0} has been saved.', [$this->humanName])); |
||
| 46 | |||
| 47 | return $this->redirect(['action' => 'thankyou', '?' => ['type' => $this->humanName]]); |
||
| 48 | } else { |
||
| 49 | $errors = $this->JiraForm->getErrors(); |
||
| 50 | $this->Flash->error(__('There was a problem saving the {0}.', [$this->humanName])); |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | if ($this->getRequest()->is('get')) { |
||
| 55 | $this->JiraForm->setData($this->JiraForm->getFormData()); |
||
| 56 | } |
||
| 57 | |||
| 58 | $this->set([ |
||
| 59 | 'form' => $this->JiraForm, |
||
| 60 | 'errors' => $errors |
||
| 61 | ]); |
||
| 74 |