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