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 |
||
55 | 1 | public function add(): ?\Cake\Http\Response |
|
56 | { |
||
57 | 1 | $errors = []; |
|
58 | 1 | if ($this->getRequest()->is('post')) { |
|
59 | if ($this->JiraForm->execute($this->getRequest()->getData())) { |
||
60 | $this->Flash->success(__('The {0} has been saved.', [$this->humanName])); |
||
61 | |||
62 | return $this->redirect(['action' => 'thankyou', '?' => ['type' => $this->humanName]]); |
||
63 | } else { |
||
64 | $errors = $this->JiraForm->getErrors(); |
||
65 | $this->Flash->error(__('There was a problem saving the {0}.', [$this->humanName])); |
||
66 | } |
||
67 | } |
||
68 | |||
69 | 1 | if ($this->getRequest()->is('get')) { |
|
70 | 1 | $this->JiraForm->setData($this->JiraForm->getFormData()); |
|
71 | } |
||
72 | |||
73 | 1 | $this->set([ |
|
74 | 1 | 'form' => $this->JiraForm, |
|
75 | 1 | 'errors' => $errors, |
|
76 | ]); |
||
77 | |||
78 | 1 | return null; |
|
79 | } |
||
90 |