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