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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Anax\Comments; |
||
4 | |||
5 | use \Anax\Configure\ConfigureInterface; |
||
6 | use \Anax\Configure\ConfigureTrait; |
||
7 | use \Anax\DI\InjectionAwareInterface; |
||
8 | use \Anax\DI\InjectionAwareTrait; |
||
9 | use \Anax\Comments\HTMLForm\CreateCommForm; |
||
10 | use \Anax\Comments\HTMLForm\UpdateCommForm; |
||
11 | use \Anax\Comments\HTMLForm\DeleteCommForm; |
||
12 | use \Anax\Comments\HTMLForm\AdminDeleteCommForm; |
||
13 | use \Anax\Comments\ShowOneService; |
||
14 | use \Anax\Comments\ShowAllService; |
||
15 | |||
16 | /** |
||
17 | * A controller class. |
||
18 | */ |
||
19 | class CommController implements |
||
20 | ConfigureInterface, |
||
21 | InjectionAwareInterface |
||
22 | { |
||
23 | use ConfigureTrait, |
||
24 | InjectionAwareTrait; |
||
25 | |||
26 | |||
27 | /** |
||
28 | * Sends data to view |
||
29 | * |
||
30 | * @param string $title |
||
31 | * @param string $crud, path to view |
||
0 ignored issues
–
show
|
|||
32 | * @param array $data, htmlcontent to view |
||
0 ignored issues
–
show
There is no parameter named
$data, . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
33 | */ |
||
34 | public function toRender($title, $crud, $data) |
||
35 | { |
||
36 | $view = $this->di->get("view"); |
||
37 | $pageRender = $this->di->get("pageRender"); |
||
38 | $view->add($crud, $data); |
||
39 | $tempfix = ""; |
||
40 | $pageRender->renderPage($tempfix, ["title" => $title]); |
||
41 | } |
||
42 | |||
43 | |||
44 | /** |
||
45 | * Show all items. |
||
46 | * |
||
47 | * @return void |
||
48 | */ |
||
49 | View Code Duplication | public function getIndex() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
50 | { |
||
51 | $title = "Inlägg"; |
||
52 | |||
53 | $text = new ShowAllService($this->di); |
||
54 | |||
55 | $data = [ |
||
56 | "items" => $text->getHTML(), |
||
57 | ]; |
||
58 | |||
59 | $crud = "comm/crud/front"; |
||
60 | $this->toRender($title, $crud, $data); |
||
61 | } |
||
62 | |||
63 | |||
64 | |||
65 | /** |
||
66 | * Handler with form to create a new item. |
||
67 | * |
||
68 | * @return void |
||
69 | */ |
||
70 | public function getPostCreateItem($id = null) |
||
71 | { |
||
72 | $title = "Skriv ett inlägg"; |
||
73 | |||
74 | $session = $this->di->get("session"); |
||
75 | $sess = $session->get("user"); |
||
76 | |||
77 | if ($sess) { |
||
78 | $form = new CreateCommForm($this->di, $sess['id'], $id); |
||
79 | $form->check(); |
||
80 | |||
81 | $data = [ |
||
82 | "form" => $form->getHTML(), |
||
83 | ]; |
||
84 | } else { |
||
85 | $data = [ |
||
86 | "form" => "Enbart för inloggade. Sorry!", |
||
87 | ]; |
||
88 | } |
||
89 | |||
90 | $crud = "comm/crud/create"; |
||
91 | $this->toRender($title, $crud, $data); |
||
92 | } |
||
93 | |||
94 | |||
95 | /** |
||
96 | * |
||
97 | * @return sessionobject |
||
98 | */ |
||
99 | public function getSess() |
||
100 | { |
||
101 | $session = $this->di->get("session"); |
||
102 | $sess = $session->get("user"); |
||
103 | return $sess; |
||
104 | } |
||
105 | |||
106 | |||
107 | /** |
||
108 | * Handler with form to delete an item. |
||
109 | * |
||
110 | * @return void |
||
111 | */ |
||
112 | View Code Duplication | public function getPostDeleteItem($id) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
113 | { |
||
114 | $title = "Ta bort ett inlägg"; |
||
115 | $sess = $this->getSess(); |
||
116 | |||
117 | if ($sess) { |
||
118 | $form = new DeleteCommForm($this->di, $id); |
||
119 | $form->check(); |
||
120 | |||
121 | $data = [ |
||
122 | "form" => $form->getHTML(), |
||
123 | ]; |
||
124 | } else { |
||
125 | $data = [ |
||
126 | "form" => "Enbart för inloggade. Sorry!", |
||
127 | ]; |
||
128 | } |
||
129 | |||
130 | $crud = "comm/crud/delete"; |
||
131 | $this->toRender($title, $crud, $data); |
||
132 | } |
||
133 | |||
134 | |||
135 | |||
136 | /** |
||
137 | * Handler with form to update an item. |
||
138 | * |
||
139 | * @return void |
||
140 | */ |
||
141 | View Code Duplication | public function getPostAdminDeleteItem() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
142 | { |
||
143 | $title = "Ta bort text"; |
||
144 | $form = new AdminDeleteCommForm($this->di); |
||
145 | |||
146 | $form->check(); |
||
147 | |||
148 | $data = [ |
||
149 | "form" => $form->getHTML(), |
||
150 | ]; |
||
151 | |||
152 | $crud = "comm/crud/admindelete"; |
||
153 | $this->toRender($title, $crud, $data); |
||
154 | } |
||
155 | |||
156 | |||
157 | |||
158 | /** |
||
159 | * Handler with form to update an item. |
||
160 | * |
||
161 | * @return void |
||
162 | */ |
||
163 | View Code Duplication | public function getPostUpdateItem($id) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
164 | { |
||
165 | $title = "Uppdatera ditt inlägg"; |
||
166 | |||
167 | $sess = $this->getSess(); |
||
168 | |||
169 | if ($sess) { |
||
170 | $form = new UpdateCommForm($this->di, $id, $sess['id']); |
||
171 | $form->check(); |
||
172 | |||
173 | $data = [ |
||
174 | "form" => $form->getHTML(), |
||
175 | ]; |
||
176 | } else { |
||
177 | $data = [ |
||
178 | "form" => "Enbart för inloggade. Sorry!", |
||
179 | ]; |
||
180 | } |
||
181 | |||
182 | $crud = "comm/crud/update"; |
||
183 | $this->toRender($title, $crud, $data); |
||
184 | } |
||
185 | |||
186 | |||
187 | /** |
||
188 | * Handler with form to just show an item. |
||
189 | * |
||
190 | * @return void |
||
191 | */ |
||
192 | View Code Duplication | public function getPostShow($id) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
193 | { |
||
194 | $title = "Inlägg"; |
||
195 | $text = new ShowOneService($this->di, $id); |
||
196 | |||
197 | $data = [ |
||
198 | "items" => $text->getHTML(), |
||
199 | ]; |
||
200 | |||
201 | $crud = "comm/crud/view-one"; |
||
202 | $this->toRender($title, $crud, $data); |
||
203 | } |
||
204 | } |
||
205 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.