This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | namespace App\Controller; |
||
0 ignored issues
–
show
|
|||
3 | |||
4 | use App\Controller\AppController; |
||
0 ignored issues
–
show
|
|||
5 | |||
6 | /** |
||
7 | * Organizations Controller |
||
8 | * |
||
9 | * @property \App\Model\Table\OrganizationsTable $Organizations |
||
10 | * |
||
11 | * @method \App\Model\Entity\Organization[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = []) |
||
12 | */ |
||
0 ignored issues
–
show
|
|||
13 | class OrganizationsController extends AppController |
||
14 | { |
||
0 ignored issues
–
show
|
|||
15 | |||
16 | /** |
||
17 | * Index method |
||
18 | * |
||
19 | * @return \Cake\Http\Response|void |
||
0 ignored issues
–
show
|
|||
20 | */ |
||
21 | public function index() |
||
22 | { |
||
0 ignored issues
–
show
|
|||
23 | $this->paginate = [ |
||
24 | 'contain' => ['Users'] |
||
0 ignored issues
–
show
|
|||
25 | ]; |
||
26 | $organizations = $this->paginate($this->Organizations); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
27 | |||
28 | $this->set(compact('organizations')); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * View method |
||
33 | * |
||
34 | * @param string|null $id Organization id. |
||
0 ignored issues
–
show
|
|||
35 | * @return \Cake\Http\Response|void |
||
0 ignored issues
–
show
|
|||
36 | * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. |
||
0 ignored issues
–
show
|
|||
37 | */ |
||
38 | public function view($id = null) |
||
39 | { |
||
0 ignored issues
–
show
|
|||
40 | $organization = $this->Organizations->get($id, [ |
||
41 | 'contain' => ['Users'] |
||
0 ignored issues
–
show
|
|||
42 | ]); |
||
43 | |||
44 | $this->set('organization', $organization); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Add method |
||
49 | * |
||
50 | * @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise. |
||
51 | */ |
||
52 | public function add() |
||
53 | { |
||
0 ignored issues
–
show
|
|||
54 | $organization = $this->Organizations->newEntity(); |
||
55 | if ($this->request->is('post')) { |
||
56 | $organization = $this->Organizations->patchEntity($organization, $this->request->getData()); |
||
57 | if ($this->Organizations->save($organization)) { |
||
58 | $this->Flash->success(__('The organization has been saved.')); |
||
59 | |||
60 | return $this->redirect(['action' => 'index']); |
||
61 | } |
||
0 ignored issues
–
show
|
|||
62 | $this->Flash->error(__('The organization could not be saved. Please, try again.')); |
||
63 | } |
||
0 ignored issues
–
show
|
|||
64 | $users = $this->Organizations->Users->find('list', ['limit' => 200]); |
||
65 | $this->set(compact('organization', 'users')); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Edit method |
||
70 | * |
||
71 | * @param string|null $id Organization id. |
||
0 ignored issues
–
show
|
|||
72 | * @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise. |
||
0 ignored issues
–
show
|
|||
73 | * @throws \Cake\Network\Exception\NotFoundException When record not found. |
||
0 ignored issues
–
show
|
|||
74 | */ |
||
75 | public function edit($id = null) |
||
76 | { |
||
0 ignored issues
–
show
|
|||
77 | $organization = $this->Organizations->get($id, [ |
||
78 | 'contain' => [] |
||
0 ignored issues
–
show
|
|||
79 | ]); |
||
80 | if ($this->request->is(['patch', 'post', 'put'])) { |
||
81 | $organization = $this->Organizations->patchEntity($organization, $this->request->getData()); |
||
82 | if ($this->Organizations->save($organization)) { |
||
83 | $this->Flash->success(__('The organization has been saved.')); |
||
84 | |||
85 | return $this->redirect(['action' => 'index']); |
||
86 | } |
||
0 ignored issues
–
show
|
|||
87 | $this->Flash->error(__('The organization could not be saved. Please, try again.')); |
||
88 | } |
||
0 ignored issues
–
show
|
|||
89 | $users = $this->Organizations->Users->find('list', ['limit' => 200]); |
||
90 | $this->set(compact('organization', 'users')); |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * Delete method |
||
95 | * |
||
96 | * @param string|null $id Organization id. |
||
0 ignored issues
–
show
|
|||
97 | * @return \Cake\Http\Response|null Redirects to index. |
||
0 ignored issues
–
show
|
|||
98 | * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. |
||
0 ignored issues
–
show
|
|||
99 | */ |
||
100 | public function delete($id = null) |
||
101 | { |
||
0 ignored issues
–
show
|
|||
102 | $this->request->allowMethod(['post', 'delete']); |
||
103 | $organization = $this->Organizations->get($id); |
||
104 | if ($this->Organizations->delete($organization)) { |
||
105 | $this->Flash->success(__('The organization has been deleted.')); |
||
106 | } else { |
||
0 ignored issues
–
show
|
|||
107 | $this->Flash->error(__('The organization could not be deleted. Please, try again.')); |
||
108 | } |
||
109 | |||
110 | return $this->redirect(['action' => 'index']); |
||
111 | } |
||
0 ignored issues
–
show
|
|||
112 | } |
||
113 |