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 Nette\Database\Context; |
||
| 6 | use Tracy\Debugger; |
||
| 7 | use App\Services\Emailer; |
||
| 8 | use App\Models\BlockModel; |
||
| 9 | use App\Models\MeetingModel; |
||
| 10 | use \Exception; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Block controller |
||
| 14 | * |
||
| 15 | * This file handles the retrieval and serving of blocks |
||
| 16 | * |
||
| 17 | * @created 2013-06-03 |
||
| 18 | * @author Tomas Litera <[email protected]> |
||
| 19 | */ |
||
| 20 | class BlockPresenter extends BasePresenter |
||
| 21 | { |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var integer |
||
| 25 | */ |
||
| 26 | private $blockId = NULL; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var Emailer |
||
| 30 | */ |
||
| 31 | private $emailer; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var MeetingModel |
||
| 35 | */ |
||
| 36 | private $meetingModel; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param BlockModel $model |
||
| 40 | * @param Emailer $emailer |
||
| 41 | */ |
||
| 42 | public function __construct(BlockModel $model, Emailer $emailer, MeetingModel $meetingModel) |
||
| 43 | { |
||
| 44 | $this->setModel($model); |
||
|
0 ignored issues
–
show
|
|||
| 45 | $this->setEmailer($emailer); |
||
| 46 | $this->setMeetingModel($meetingModel); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return void |
||
| 51 | */ |
||
| 52 | public function renderNew() |
||
| 53 | { |
||
| 54 | $template = $this->getTemplate(); |
||
| 55 | |||
| 56 | $template->heading = 'nový blok'; |
||
|
0 ignored issues
–
show
Accessing
heading 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...
|
|||
| 57 | $template->page = $this->getHttpRequest()->getQuery('page'); |
||
|
0 ignored issues
–
show
Accessing
page 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...
|
|||
| 58 | $template->error_name = ""; |
||
|
0 ignored issues
–
show
Accessing
error_name 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...
|
|||
| 59 | $template->error_description = ""; |
||
|
0 ignored issues
–
show
Accessing
error_description 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...
|
|||
| 60 | $template->error_tutor = ""; |
||
|
0 ignored issues
–
show
Accessing
error_tutor 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...
|
|||
| 61 | $template->error_email = ""; |
||
|
0 ignored issues
–
show
Accessing
error_email 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...
|
|||
| 62 | $template->error_material = ""; |
||
|
0 ignored issues
–
show
Accessing
error_material 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...
|
|||
| 63 | |||
| 64 | $template->day_roll = $this->renderHtmlSelectBox('day', $this->days, null, 'width:172px;'); |
||
|
0 ignored issues
–
show
Accessing
day_roll 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...
|
|||
| 65 | $template->hour_roll = $this->renderHtmlSelectBox('start_hour', $this->hours, date('H')); |
||
|
0 ignored issues
–
show
Accessing
hour_roll 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...
|
|||
| 66 | $template->minute_roll = $this->renderHtmlSelectBox('start_minute', $this->minutes, date('i')); |
||
|
0 ignored issues
–
show
Accessing
minute_roll 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...
|
|||
| 67 | $template->end_hour_roll = $this->renderHtmlSelectBox('end_hour', $this->hours, date('H')+1); |
||
|
0 ignored issues
–
show
Accessing
end_hour_roll 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...
|
|||
| 68 | $template->end_minute_roll = $this->renderHtmlSelectBox('end_minute', $this->minutes, date('i')); |
||
|
0 ignored issues
–
show
Accessing
end_minute_roll 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...
|
|||
| 69 | // is program block check box |
||
| 70 | $template->program_checkbox = $this->renderHtmlCheckBox('program', 1, 0); |
||
|
0 ignored issues
–
show
Accessing
program_checkbox 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...
|
|||
| 71 | // display programs in block check box |
||
| 72 | $template->display_progs_checkbox = $this->renderHtmlCheckBox('display_progs', 0, null); |
||
|
0 ignored issues
–
show
Accessing
display_progs_checkbox 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...
|
|||
| 73 | $template->selectedCategory = null; |
||
|
0 ignored issues
–
show
Accessing
selectedCategory 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...
|
|||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return void |
||
| 78 | */ |
||
| 79 | public function actionCreate() |
||
| 80 | { |
||
| 81 | $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...
|
|||
| 82 | $data = $this->getHttpRequest()->getPost(); |
||
| 83 | |||
| 84 | $this->setBacklink($data['backlink']); |
||
| 85 | $data['from'] = date('H:i:s', mktime($data['start_hour'], $data['start_minute'], 0, 0, 0, 0)); |
||
| 86 | $data['to'] = date('H:i:s', mktime($data['end_hour'], $data['end_minute'], 0, 0, 0, 0)); |
||
| 87 | $data['meeting'] = $this->getMeetingId(); |
||
| 88 | |||
| 89 | unset($data['start_hour']); |
||
| 90 | unset($data['end_hour']); |
||
| 91 | unset($data['start_minute']); |
||
| 92 | unset($data['end_minute']); |
||
| 93 | unset($data['backlink']); |
||
| 94 | |||
| 95 | try { |
||
| 96 | $this->guardToGreaterThanFrom($data['from'], $data['to']); |
||
| 97 | $result = $this->getModel()->create($data); |
||
| 98 | |||
| 99 | Debugger::log('Creation of block successfull, result: ' . json_encode($result), Debugger::INFO); |
||
| 100 | |||
| 101 | $this->flashMessage('Položka byla úspěšně vytvořena', 'ok'); |
||
| 102 | } catch(Exception $e) { |
||
| 103 | Debugger::log('Creation of block with data ' . json_encode($data) . ' failed, result: ' . $e->getMessage(), Debugger::ERROR); |
||
| 104 | |||
| 105 | $this->flashMessage('Creation of block failed, result: ' . $e->getMessage(), 'error'); |
||
| 106 | } |
||
| 107 | |||
| 108 | $this->redirect($this->getBacklink() ?: 'Block:listing'); |
||
| 109 | } |
||
| 110 | |||
| 111 | /** |
||
| 112 | * @param integer $id |
||
| 113 | * @return void |
||
| 114 | */ |
||
| 115 | public function actionUpdate($id) |
||
| 116 | { |
||
| 117 | $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...
|
|||
| 118 | $data = $this->getHttpRequest()->getPost(); |
||
| 119 | |||
| 120 | $this->setBacklink($data['backlink']); |
||
| 121 | $data['from'] = date('H:i:s', mktime($data['start_hour'], $data['start_minute'], 0, 0, 0, 0)); |
||
| 122 | $data['to'] = date('H:i:s', mktime($data['end_hour'], $data['end_minute'], 0, 0, 0, 0)); |
||
| 123 | $data['meeting'] = $this->getMeetingId(); |
||
| 124 | array_key_exists('display_progs', $data) ?: $data['display_progs'] = '1'; |
||
| 125 | |||
| 126 | unset($data['start_hour']); |
||
| 127 | unset($data['end_hour']); |
||
| 128 | unset($data['start_minute']); |
||
| 129 | unset($data['end_minute']); |
||
| 130 | unset($data['backlink']); |
||
| 131 | |||
| 132 | try { |
||
| 133 | $this->guardToGreaterThanFrom($data['from'], $data['to']); |
||
| 134 | $result = $this->getModel()->update($id, $data); |
||
| 135 | |||
| 136 | Debugger::log('Modification of block id ' . $id . ' with data ' . json_encode($data) . ' successfull, result: ' . json_encode($result), Debugger::INFO); |
||
| 137 | |||
| 138 | $this->flashMessage('Položka byla úspěšně upravena.', 'ok'); |
||
| 139 | } catch(Exception $e) { |
||
| 140 | Debugger::log('Modification of block id ' . $id . ' failed, result: ' . $e->getMessage(), Debugger::ERROR); |
||
| 141 | |||
| 142 | $this->flashMessage('Modification of block id ' . $id . ' failed, result: ' . $e->getMessage(), 'error'); |
||
| 143 | } |
||
| 144 | |||
| 145 | $this->redirect($this->getBacklink() ?: 'Block:listing'); |
||
| 146 | } |
||
| 147 | |||
| 148 | /** |
||
| 149 | * @param int $id |
||
| 150 | * @return void |
||
| 151 | */ |
||
| 152 | View Code Duplication | public function actionDelete($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...
|
|||
| 153 | { |
||
| 154 | try { |
||
| 155 | $result = $this->getModel()->delete($id); |
||
| 156 | Debugger::log('Destroying of block successfull, result: ' . json_encode($result), Debugger::INFO); |
||
| 157 | $this->flashMessage('Položka byla úspěšně smazána.', 'ok'); |
||
| 158 | } catch(Exception $e) { |
||
| 159 | Debugger::log('Destroying of block failed, result: ' . $e->getMessage(), Debugger::ERROR); |
||
| 160 | $this->flashMessage('Destroying of block failed, result: ' . $e->getMessage(), 'error'); |
||
| 161 | } |
||
| 162 | |||
| 163 | $this->redirect('Block:listing'); |
||
| 164 | } |
||
| 165 | |||
| 166 | /** |
||
| 167 | * Send mail to tutor |
||
| 168 | * |
||
| 169 | * @return void |
||
| 170 | */ |
||
| 171 | public function actionMail($id) |
||
| 172 | { |
||
| 173 | try { |
||
| 174 | $tutors = $this->getModel()->getTutor($id); |
||
| 175 | $recipients = $this->parseTutorEmail($tutors); |
||
| 176 | |||
| 177 | $this->getEmailer()->tutor($recipients, $tutors->guid, 'block'); |
||
| 178 | |||
| 179 | Debugger::log('Sending email to block tutor successfull, result: ' . json_encode($recipients) . ', ' . $tutors->guid, Debugger::INFO); |
||
| 180 | $this->flashMessage('Email lektorovi byl odeslán..', 'ok'); |
||
| 181 | } catch(Exception $e) { |
||
| 182 | Debugger::log('Sending email to block tutor failed, result: ' . $e->getMessage(), Debugger::ERROR); |
||
| 183 | $this->flashMessage('Email lektorovi nebyl odeslán, result: ' . $e->getMessage(), 'error'); |
||
| 184 | } |
||
| 185 | |||
| 186 | $this->redirect('Block:edit', $id); |
||
| 187 | } |
||
| 188 | |||
| 189 | /** |
||
| 190 | * Prepare data for editing |
||
| 191 | * |
||
| 192 | * @param int $id of Block |
||
| 193 | * @return void |
||
| 194 | */ |
||
| 195 | public function renderEdit($id) |
||
| 196 | { |
||
| 197 | $template = $this->getTemplate(); |
||
| 198 | |||
| 199 | $template->heading = 'úprava bloku'; |
||
|
0 ignored issues
–
show
Accessing
heading 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...
|
|||
| 200 | $template->page = $this->getHttpRequest()->getQuery('page'); |
||
|
0 ignored issues
–
show
Accessing
page 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...
|
|||
| 201 | $template->error_name = ""; |
||
|
0 ignored issues
–
show
Accessing
error_name 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...
|
|||
| 202 | $template->error_description = ""; |
||
|
0 ignored issues
–
show
Accessing
error_description 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...
|
|||
| 203 | $template->error_tutor = ""; |
||
|
0 ignored issues
–
show
Accessing
error_tutor 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...
|
|||
| 204 | $template->error_email = ""; |
||
|
0 ignored issues
–
show
Accessing
error_email 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...
|
|||
| 205 | $template->error_material = ""; |
||
|
0 ignored issues
–
show
Accessing
error_material 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...
|
|||
| 206 | |||
| 207 | $this->blockId = $id; |
||
| 208 | $block = $this->getModel()->find($id); |
||
| 209 | $template->block = $block; |
||
|
0 ignored issues
–
show
Accessing
block 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...
|
|||
| 210 | $template->id = $id; |
||
|
0 ignored issues
–
show
Accessing
id 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...
|
|||
| 211 | |||
| 212 | $template->day_roll = $this->renderHtmlSelectBox('day', $this->days, $block->day, 'width:172px;'); |
||
|
0 ignored issues
–
show
Accessing
day_roll 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...
|
|||
| 213 | $template->hour_roll = $this->renderHtmlSelectBox('start_hour', $this->hours, $block->from->format('%H')); |
||
|
0 ignored issues
–
show
Accessing
hour_roll 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...
|
|||
| 214 | $template->minute_roll = $this->renderHtmlSelectBox('start_minute', $this->minutes, $block->from->format('%I')); |
||
|
0 ignored issues
–
show
Accessing
minute_roll 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...
|
|||
| 215 | $template->end_hour_roll = $this->renderHtmlSelectBox('end_hour', $this->hours, $block->to->format('%H')); |
||
|
0 ignored issues
–
show
Accessing
end_hour_roll 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...
|
|||
| 216 | $template->end_minute_roll = $this->renderHtmlSelectBox('end_minute', $this->minutes, $block->to->format('%I')); |
||
|
0 ignored issues
–
show
Accessing
end_minute_roll 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...
|
|||
| 217 | // is program block check box |
||
| 218 | $template->program_checkbox = $this->renderHtmlCheckBox('program', 1, $block->program); |
||
|
0 ignored issues
–
show
Accessing
program_checkbox 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...
|
|||
| 219 | // display programs in block check box |
||
| 220 | $template->display_progs_checkbox = $this->renderHtmlCheckBox('display_progs', 0, $block->display_progs); |
||
|
0 ignored issues
–
show
Accessing
display_progs_checkbox 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...
|
|||
| 221 | $template->selectedCategory = $block->category; |
||
|
0 ignored issues
–
show
Accessing
selectedCategory 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...
|
|||
| 222 | } |
||
| 223 | |||
| 224 | /** |
||
| 225 | * @return void |
||
| 226 | */ |
||
| 227 | View Code Duplication | public function renderListing() |
|
|
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...
|
|||
| 228 | { |
||
| 229 | $model = $this->getModel(); |
||
| 230 | $template = $this->getTemplate(); |
||
| 231 | |||
| 232 | $template->blocks = $model->all(); |
||
|
0 ignored issues
–
show
Accessing
blocks 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...
|
|||
| 233 | $template->mid = $this->meetingId; |
||
|
0 ignored issues
–
show
Accessing
mid 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...
|
|||
| 234 | $template->heading = $this->heading; |
||
|
0 ignored issues
–
show
Accessing
heading 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...
|
|||
| 235 | } |
||
| 236 | |||
| 237 | /** |
||
| 238 | * @return Emailer |
||
| 239 | */ |
||
| 240 | protected function getEmailer() |
||
| 241 | { |
||
| 242 | return $this->emailer; |
||
| 243 | } |
||
| 244 | |||
| 245 | /** |
||
| 246 | * @param Emailer $emailer |
||
| 247 | * @return $this |
||
| 248 | */ |
||
| 249 | protected function setEmailer(Emailer $emailer) |
||
| 250 | { |
||
| 251 | $this->emailer = $emailer; |
||
| 252 | return $this; |
||
| 253 | } |
||
| 254 | |||
| 255 | /** |
||
| 256 | * Render select box |
||
| 257 | * |
||
| 258 | * @param string name |
||
| 259 | * @param array content of slect box |
||
| 260 | * @param var variable that match selected option |
||
| 261 | * @param string inline styling |
||
| 262 | * @return string html of select box |
||
| 263 | */ |
||
| 264 | private function renderHtmlSelectBox($name, $select_content, $selected_option, $inline_style = NULL) |
||
| 265 | { |
||
| 266 | if(isset($inline_style) && $inline_style != NULL){ |
||
| 267 | $style = " style='".$inline_style."'"; |
||
| 268 | } else { |
||
| 269 | $style = ""; |
||
| 270 | } |
||
| 271 | $html_select = "<select name='".$name."'".$style.">"; |
||
| 272 | foreach ($select_content as $key => $value) { |
||
| 273 | if($key == $selected_option) { |
||
| 274 | $selected = 'selected'; |
||
| 275 | } else { |
||
| 276 | $selected = ''; |
||
| 277 | } |
||
| 278 | $html_select .= "<option value='".$key."' ".$selected.">".$value."</option>"; |
||
| 279 | } |
||
| 280 | $html_select .= '</select>'; |
||
| 281 | |||
| 282 | return $html_select; |
||
| 283 | } |
||
| 284 | |||
| 285 | /** |
||
| 286 | * @param date $from |
||
| 287 | * @param date $to |
||
| 288 | * @return Exception |
||
| 289 | */ |
||
| 290 | private function guardToGreaterThanFrom($from, $to) |
||
| 291 | { |
||
| 292 | if($from > $to) { |
||
| 293 | throw new Exception('Starting time is greater then finishing time.'); |
||
| 294 | } |
||
| 295 | } |
||
| 296 | |||
| 297 | |||
| 298 | /** |
||
| 299 | * @return MeetingModel |
||
| 300 | */ |
||
| 301 | public function getMeetingModel(): MeetingModel |
||
| 302 | { |
||
| 303 | return $this->meetingModel; |
||
| 304 | } |
||
| 305 | |||
| 306 | /** |
||
| 307 | * @param MeetingModel $meetingModel |
||
| 308 | * |
||
| 309 | * @return self |
||
| 310 | */ |
||
| 311 | public function setMeetingModel(MeetingModel $meetingModel): self |
||
| 312 | { |
||
| 313 | $this->meetingModel = $meetingModel; |
||
| 314 | |||
| 315 | return $this; |
||
| 316 | } |
||
| 317 | |||
| 318 | } |
||
| 319 |
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: