| Conditions | 4 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.7286 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 57 | 1 | public function add(): ?\Cake\Http\Response |
|
| 58 | { |
||
| 59 | 1 | $errors = []; |
|
| 60 | 1 | if ($this->getRequest()->is('post')) { |
|
| 61 | if ($this->JiraForm->execute($this->getRequest()->getData())) { |
||
| 62 | $this->Flash->success(__('The {0} has been saved.', [$this->humanName])); |
||
| 63 | |||
| 64 | return $this->redirect(['action' => 'thankyou', '?' => ['type' => $this->humanName]]); |
||
| 65 | } else { |
||
| 66 | $errors = $this->JiraForm->getErrors(); |
||
| 67 | $this->Flash->error(__('There was a problem saving the {0}.', [$this->humanName])); |
||
| 68 | } |
||
| 69 | } |
||
| 70 | |||
| 71 | 1 | if ($this->getRequest()->is('get')) { |
|
| 72 | 1 | $this->JiraForm->setData($this->JiraForm->getFormData()); |
|
| 73 | } |
||
| 74 | |||
| 75 | 1 | $this->set([ |
|
| 76 | 1 | 'form' => $this->JiraForm, |
|
| 77 | 1 | 'errors' => $errors, |
|
| 78 | ]); |
||
| 79 | |||
| 80 | 1 | return null; |
|
| 81 | } |
||
| 93 |