literat /
srazvs
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 App\Presenters; |
||
| 4 | |||
| 5 | use App\Models\MeetingModel; |
||
| 6 | use Tracy\Debugger; |
||
| 7 | use Exception; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * This file handles the retrieval and serving of news articles |
||
| 11 | */ |
||
| 12 | class MeetingPresenter extends BasePresenter |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Prepare initial values |
||
| 17 | */ |
||
| 18 | public function __construct(MeetingModel $model) |
||
| 19 | { |
||
| 20 | $this->setModel($model); |
||
|
0 ignored issues
–
show
|
|||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @return void |
||
| 25 | */ |
||
| 26 | View Code Duplication | public function actionCreate() |
|
|
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. Loading history...
|
|||
| 27 | { |
||
| 28 | try { |
||
| 29 | $model = $this->getModel(); |
||
|
0 ignored issues
–
show
$model is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 30 | $data = $this->getHttpRequest()->getPost(); |
||
| 31 | $result = $this->getModel()->create($data); |
||
| 32 | |||
| 33 | Debugger::log('Creation of meeting successfull, result: ' . json_encode($result), Debugger::INFO); |
||
| 34 | $this->flashMessage('Položka byla úspěšně vytvořena', 'ok'); |
||
| 35 | } catch(Exception $e) { |
||
| 36 | Debugger::log('Creation of meeting with data ' . json_encode($data) . ' failed, result: ' . $e->getMessage(), Debugger::ERROR); |
||
|
0 ignored issues
–
show
The variable
$data does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
Loading history...
|
|||
| 37 | $this->flashMessage('Creation of meeting failed, result: ' . $e->getMessage(), 'error'); |
||
| 38 | } |
||
| 39 | |||
| 40 | $this->redirect('Meeting:listing'); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param integer $id |
||
| 45 | * @return void |
||
| 46 | */ |
||
| 47 | View Code Duplication | public function actionUpdate($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. Loading history...
|
|||
| 48 | { |
||
| 49 | try { |
||
| 50 | $data = $this->getHttpRequest()->getPost(); |
||
| 51 | $result = $this->getModel()->update($id, $data); |
||
| 52 | |||
| 53 | Debugger::log('Modification of meeting id ' . $id . ' with data ' . json_encode($data) . ' successfull, result: ' . json_encode($result), Debugger::INFO); |
||
| 54 | $this->flashMessage('Položka byla úspěšně upravena', 'ok'); |
||
| 55 | } catch(Exception $e) { |
||
| 56 | Debugger::log('Modification of meeting id ' . $id . ' failed, result: ' . $e->getMessage(), Debugger::ERROR); |
||
| 57 | $this->flashMessage('Modification of meeting id ' . $id . ' failed, result: ' . $e->getMessage(), 'error'); |
||
| 58 | } |
||
| 59 | |||
| 60 | $this->redirect('Meeting:listing'); |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Delete item |
||
| 65 | * @param int $id of item |
||
| 66 | * @return void |
||
| 67 | */ |
||
| 68 | public function actionDelete($id) |
||
| 69 | { |
||
| 70 | try { |
||
| 71 | $result = $this->getModel()->delete($id); |
||
| 72 | Debugger::log('Destroying of meeting('. $id .') successfull, result: ' . json_encode($result), Debugger::INFO); |
||
| 73 | $this->flashMessage('Položka byla úspěšně smazána', 'ok'); |
||
| 74 | } catch(Exception $e) { |
||
| 75 | Debugger::log('Destroying of meeting('. $id .') failed, result: ' . $e->getMessage(), Debugger::ERROR); |
||
| 76 | $this->flashMessage('Destroying of meeting failed, result: ' . $e->getMessage(), 'error'); |
||
| 77 | } |
||
| 78 | |||
| 79 | $this->redirect('Meeting:listing'); |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @return void |
||
| 84 | */ |
||
| 85 | public function renderNew() |
||
| 86 | { |
||
| 87 | $template = $this->getTemplate(); |
||
| 88 | ////inicializace promenych |
||
| 89 | $template->error_start = ""; |
||
|
0 ignored issues
–
show
Accessing
error_start on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 90 | $template->error_end = ""; |
||
|
0 ignored issues
–
show
Accessing
error_end on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 91 | $template->error_open_reg = ""; |
||
|
0 ignored issues
–
show
Accessing
error_open_reg on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 92 | $template->error_close_reg = ""; |
||
|
0 ignored issues
–
show
Accessing
error_close_reg on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 93 | $template->error_login = ""; |
||
|
0 ignored issues
–
show
Accessing
error_login on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @return void |
||
| 98 | */ |
||
| 99 | public function renderEdit($id) |
||
| 100 | { |
||
| 101 | $template = $this->getTemplate(); |
||
| 102 | ////inicializace promenych |
||
| 103 | $template->error_start = ""; |
||
|
0 ignored issues
–
show
Accessing
error_start on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 104 | $template->error_end = ""; |
||
|
0 ignored issues
–
show
Accessing
error_end on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 105 | $template->error_open_reg = ""; |
||
|
0 ignored issues
–
show
Accessing
error_open_reg on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 106 | $template->error_close_reg = ""; |
||
|
0 ignored issues
–
show
Accessing
error_close_reg on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 107 | $template->error_login = ""; |
||
|
0 ignored issues
–
show
Accessing
error_login on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 108 | |||
| 109 | $template->meetingId = $id; |
||
|
0 ignored issues
–
show
Accessing
meetingId on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 110 | $template->data = $this->getModel()->find($id); |
||
|
0 ignored issues
–
show
Accessing
data on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 111 | } |
||
| 112 | |||
| 113 | /** |
||
| 114 | * Render entire page |
||
| 115 | * @return void |
||
| 116 | */ |
||
| 117 | public function renderListing() |
||
| 118 | { |
||
| 119 | $template = $this->getTemplate(); |
||
| 120 | ////inicializace promenych |
||
| 121 | $template->error_start = ""; |
||
|
0 ignored issues
–
show
Accessing
error_start on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 122 | $template->error_end = ""; |
||
|
0 ignored issues
–
show
Accessing
error_end on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 123 | $template->error_open_reg = ""; |
||
|
0 ignored issues
–
show
Accessing
error_open_reg on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 124 | $template->error_close_reg = ""; |
||
|
0 ignored issues
–
show
Accessing
error_close_reg on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 125 | $template->error_login = ""; |
||
|
0 ignored issues
–
show
Accessing
error_login on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 126 | |||
| 127 | $template->meetingId = $this->getMeetingId(); |
||
|
0 ignored issues
–
show
Accessing
meetingId on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 128 | $template->render = $this->getModel()->all(); |
||
|
0 ignored issues
–
show
Accessing
render on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 129 | $template->data = $this->getModel()->find($this->getMeetingId()); |
||
|
0 ignored issues
–
show
Accessing
data on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 130 | } |
||
| 131 | |||
| 132 | } |
||
| 133 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: