Completed
Push — master ( fea2cb...118c60 )
by Litera
21s
created

ProgramPresenter::startup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace App\Presenters;
4
5
use App\Components\PublicProgramOverviewControl;
6
use App\Components\CategoryStylesControl;
7
use App\Components\IProgramOverviewControl;
8
use App\Models\BlockModel;
9
use App\Models\MeetingModel;
10
use App\Models\ProgramModel;
11
use App\Services\Emailer;
12
use Tracy\Debugger;
13
14
/**
15
 * Program controller
16
 *
17
 * This file handles the retrieval and serving of blocks
18
 *
19
 * @created 2013-06-05
20
 * @author Tomas Litera <[email protected]>
21
 */
22
class ProgramPresenter extends BasePresenter
23
{
24
25
	/**
26
	 * @var integer
27
	 */
28
	private $programId = null;
29
30
	/**
31
	 * @var Emailer
32
	 */
33
	private $emailer;
34
35
	/**
36
	 * @var BlockModel
37
	 */
38
	private $blockModel;
39
40
	/**
41
	 * @var MeetingModel
42
	 */
43
	private $meetingModel;
44
45
	/**
46
	 * @var ProgramOverviewControl
47
	 */
48
	private $programOverview;
49
50
	/**
51
	 * @var CategoryStylesControl
52
	 */
53
	private $categoryStyles;
54
55
	/**
56
	 * Prepare model classes and get meeting id
57
	 */
58
	public function __construct(
59
		ProgramModel $model,
60
		Emailer $emailer,
61
		BlockModel $blockModel,
62
		MeetingModel $meetingModel,
63
		PublicProgramOverviewControl $publicProgramOverview,
64
		CategoryStylesControl $categoryStyles
65
	) {
66
		$this->setModel($model);
0 ignored issues
show
Documentation introduced by
$model is of type object<App\Models\ProgramModel>, but the function expects a object<App\Model>.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
67
		$this->setEmailer($emailer);
68
		$this->setBlockModel($blockModel);
69
		$this->setMeetingModel($meetingModel);
70
		$this->setProgramOverviewControl($publicProgramOverview);
71
		$this->setCategoryStylesControl($categoryStyles);
72
	}
73
74
	/**
75
	 * @return void
76
	 */
77
	public function startup()
78
	{
79
		parent::startup();
80
81
		$meetingId = $this->getMeetingId();
82
		$this->getModel()->setMeetingId($meetingId);
83
		$this->getMeetingModel()->setMeetingId($meetingId);
84
		$this->getBlockModel()->setMeetingId($meetingId);
85
	}
86
87
	/**
88
	 * @return void
89
	 */
90
	public function actionCreate()
91
	{
92
		$model = $this->getModel();
0 ignored issues
show
Unused Code introduced by
$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 $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
93
		$data = $this->getHttpRequest()->getPost();
94
95
		try {
96 View Code Duplication
			if(array_key_exists('backlink', $data) && isset($data['backlink'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
97
				$this->setBacklink($data['backlink']);
98
				unset($data['backlink']);
99
			}
100
101
			if(!array_key_exists('display_in_reg', $data)) {
102
				$data['display_in_reg'] = 1;
103
			}
104
105
			$result = $this->getModel()->create($data);
106
107
			$this->logInfo('Creation of program successfull, result: %s', [
108
				json_encode($result)
109
			]);
110
111
			$this->flashSuccess('Položka byla úspěšně vytvořena');
112
		} catch(Exception $e) {
0 ignored issues
show
Bug introduced by
The class App\Presenters\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
113
			$this->logError('Creation of program with data %s failed, result: %s', [
114
				json_encode($data),
115
				$e->getMessage()
116
			]);
117
118
			$this->flashError('Záznam se nepodařilo uložit, result: %s', [
0 ignored issues
show
Unused Code introduced by
The call to ProgramPresenter::flashError() has too many arguments starting with array($e->getMessage()).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
119
				$e->getMessage()
120
			]);
121
		}
122
123
		$this->redirect($this->getBacklink() ?: 'Program:listing');
124
	}
125
126
	/**
127
	 * @param  integer $id
128
	 * @return void
129
	 */
130
	public function actionUpdate($id)
131
	{
132
		$model = $this->getModel();
0 ignored issues
show
Unused Code introduced by
$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 $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
133
		$data = $this->getHttpRequest()->getPost();
134
135
		try {
136 View Code Duplication
			if(array_key_exists('backlink', $data) && isset($data['backlink'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
137
				$this->setBacklink($data['backlink']);
138
				unset($data['backlink']);
139
			}
140
141
			if(!array_key_exists('display_in_reg', $data)) {
142
				$data['display_in_reg'] = 1;
143
			}
144
145
			$result = $this->getModel()->update($id, $data);
146
147
			$this->logInfo('Modification of program id %s with data %s successfull, result: %s', [
148
				$id,
149
				json_encode($data),
150
				json_encode($result)
151
			]);
152
153
			$this->flashSuccess('Položka byla úspěšně upravena.');
154
		} catch(Exception $e) {
0 ignored issues
show
Bug introduced by
The class App\Presenters\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
155
			$this->logError('Modification of program id %s failed, result: %s', [
156
				$id,
157
				$e->getMessage()
158
			]);
159
160
			$this->flashError('Modification of program id %s failed, result: %s', [
0 ignored issues
show
Unused Code introduced by
The call to ProgramPresenter::flashError() has too many arguments starting with array($id, $e->getMessage()).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
161
				$id,
162
				$e->getMessage()
163
			]);
164
		}
165
166
		$this->redirect($this->getBacklink() ?: 'Program:listing');
167
	}
168
169
	/**
170
	 * @param  integer  $id
171
	 * @return void
172
	 */
173
	public function actionDelete($id)
174
	{
175
		try {
176
			$result = $this->getModel()->delete($id);
177
			$this->logInfo('Destroying of program successfull, result: %s', [
178
				json_encode($result)
179
			]);
180
			$this->flashSuccess('Položka byla úspěšně smazána.');
181
		} catch(Exception $e) {
0 ignored issues
show
Bug introduced by
The class App\Presenters\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
182
			$this->logError('Destroying of program failed, result: %s', [
183
				$e->getMessage()
184
			]);
185
			$this->flashError('Smazání programu se nezdařilo, result: %s', [
0 ignored issues
show
Unused Code introduced by
The call to ProgramPresenter::flashError() has too many arguments starting with array($e->getMessage()).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
186
				$e->getMessage()
187
			]);
188
		}
189
190
		$this->redirect('Program:listing');
191
	}
192
193
	/**
194
	 * @return void
195
	 */
196
	public function actionMail($id)
197
	{
198
		try {
199
			$tutors = $this->getModel()->getTutor($id);
200
			$recipients = $this->parseTutorEmail($tutors);
201
202
			$this->getEmailer()->tutor($recipients, $tutors->guid, 'program');
203
204
			$this->logInfo('Sending email to program tutor successfull, result: %s, %s', [
205
				json_encode($recipients),
206
				$tutors->guid
207
			]);
208
			$this->flashSuccess('Email lektorovi byl odeslán..');
209
		} catch(Exception $e) {
0 ignored issues
show
Bug introduced by
The class App\Presenters\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
210
			$this->logError('Sending email to program tutor failed, result: %s', [
211
				$e->getMessage()
212
			]);
213
			$this->flashError('Email lektorovi nebyl odeslán, result: %s', [
0 ignored issues
show
Unused Code introduced by
The call to ProgramPresenter::flashError() has too many arguments starting with array($e->getMessage()).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
214
				$e->getMessage()
215
			]);
216
		}
217
218
		$this->redirect('Program:edit', $id);
219
	}
220
221
	/**
222
	 * View public program
223
	 *
224
	 * @return void
225
	 */
226
	public function renderPublic()
227
	{
228
		$this->getMeetingModel()->setRegistrationHandlers($this->getMeetingId());
229
230
		$template = $this->getTemplate();
231
		$template->meeting_heading = $this->getMeetingModel()->getRegHeading();
0 ignored issues
show
Bug introduced by
Accessing meeting_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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
232
			////otevirani a uzavirani prihlasovani
233
		if(($this->getMeetingModel()->getRegOpening() < time()) || $this->getDebugMode()) {
234
			$template->display_program = true;
0 ignored issues
show
Bug introduced by
Accessing display_program 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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
235
		} else {
236
			$template->display_program = false;
0 ignored issues
show
Bug introduced by
Accessing display_program 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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
237
		}
238
		$template->page_title = 'Srazy VS - veřejný program';
0 ignored issues
show
Bug introduced by
Accessing page_title 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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
239
		$template->style = 'table { border-collapse:separate; width:100%; }
0 ignored issues
show
Bug introduced by
Accessing style 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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
240
				td { .width:100%; text-align:center; padding:0px; }
241
				td.day { border:1px solid black; background-color:#777777; width:80px; }
242
				td.time { background-color:#cccccc; width:80px; }';
243
	}
244
245
	/**
246
	 * @return void
247
	 */
248 View Code Duplication
	public function renderListing()
0 ignored issues
show
Duplication introduced by
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...
249
	{
250
		$model = $this->getModel();
251
		$template = $this->getTemplate();
252
253
		$template->programs = $model->all();
0 ignored issues
show
Bug introduced by
Accessing programs 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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
254
		$template->mid = $this->meetingId;
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
255
		$template->heading = $this->heading;
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
256
	}
257
258
	/**
259
	 * @return void
260
	 */
261
	public function renderNew()
262
	{
263
		$template = $this->getTemplate();
264
265
		$template->heading = 'nový program';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
266
		$template->page = $this->getHttpRequest()->getQuery('page');
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
267
		$template->error_name = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
268
		$template->error_description = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
269
		$template->error_tutor = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
270
		$template->error_email = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
271
		$template->error_material = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
272
		$template->display_in_reg_checkbox = $this->renderHtmlCheckBox('display_in_reg', 0, 1);
0 ignored issues
show
Bug introduced by
Accessing display_in_reg_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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
273
		$template->block_select = $this->getBlockModel()->renderHtmlSelect(null);
0 ignored issues
show
Bug introduced by
Accessing block_select 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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
274
		$template->selectedCategory	= null;
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
275
	}
276
277
	/**
278
	 * @param  integer $id
279
	 * @return void
280
	 */
281
	public function renderEdit($id)
282
	{
283
		$this->programId = $id;
284
		$program = $this->getModel()->find($id);
285
286
		$template = $this->getTemplate();
287
		$template->heading = 'úprava programu';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
288
		$template->error_name = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
289
		$template->error_description = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
290
		$template->error_tutor = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
291
		$template->error_email = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
292
		$template->error_material = '';
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
293
		$template->display_in_reg_checkbox = $this->renderHtmlCheckBox('display_in_reg', 1, $program->display_in_reg);
0 ignored issues
show
Bug introduced by
Accessing display_in_reg_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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
294
		$template->block_select = $this->getBlockModel()->renderHtmlSelect($program->block);
0 ignored issues
show
Bug introduced by
Accessing block_select 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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
295
		$template->selectedCategory	= $program->category;
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
296
		$template->program_visitors = $this->getModel()->getProgramVisitors($id);
0 ignored issues
show
Bug introduced by
Accessing program_visitors 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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
297
		$template->program = $program;
0 ignored issues
show
Bug introduced by
Accessing program 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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
298
		$template->id = $id;
0 ignored issues
show
Bug introduced by
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

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
299
	}
300
301
	/**
302
	 * @return ProgramOverviewControl
303
	 */
304
	protected function createComponentProgramOverview()
305
	{
306
		return $this->programOverview->setMeetingId($this->getMeetingId());
307
	}
308
309
	/**
310
	 * @return CategoryStylesControl
311
	 */
312
	protected function createComponentCategoryStyles(): CategoryStylesControl
313
	{
314
		return $this->categoryStyles;
315
	}
316
317
	/**
318
	 * @param  ProgramOverviewControl $control
319
	 * @return $this
320
	 */
321
	protected function setProgramOverviewControl(IProgramOverviewControl $control)
322
	{
323
		$this->programOverview = $control;
0 ignored issues
show
Documentation Bug introduced by
It seems like $control of type object<App\Components\IProgramOverviewControl> is incompatible with the declared type object<App\Presenters\ProgramOverviewControl> of property $programOverview.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
324
325
		return $this;
326
	}
327
328
	/**
329
	 * @return Emailer
330
	 */
331
	protected function getEmailer()
332
	{
333
		return $this->emailer;
334
	}
335
336
	/**
337
	 * @param  Emailer $emailer
338
	 * @return $this
339
	 */
340
	protected function setEmailer(Emailer $emailer)
341
	{
342
		$this->emailer = $emailer;
343
		return $this;
344
	}
345
346
	/**
347
	 * @return BlockModel
348
	 */
349
	protected function getBlockModel()
350
	{
351
		return $this->blockModel;
352
	}
353
354
	/**
355
	 * @param  BlockModel $blockModel
356
	 * @return $this
357
	 */
358
	protected function setBlockModel(BlockModel $blockModel)
359
	{
360
		$this->blockModel = $blockModel;
361
		return $this;
362
	}
363
364
	/**
365
	 * @return MeetingModel
366
	 */
367
	protected function getMeetingModel()
368
	{
369
		return $this->meetingModel;
370
	}
371
372
	/**
373
	 * @param  MeetingModel $model
374
	 * @return $this
375
	 */
376
	protected function setMeetingModel(MeetingModel $model)
377
	{
378
		$this->meetingModel = $model;
379
		return $this;
380
	}
381
382
	/**
383
	 * @param CategoryStylesControl $categoryStyles
384
	 *
385
	 * @return self
386
	 */
387
	public function setCategoryStylesControl(CategoryStylesControl $categoryStyles): self
388
	{
389
		$this->categoryStyles = $categoryStyles;
390
391
		return $this;
392
	}
393
394
}
395