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