Completed
Pull Request — devel (#144)
by Litera
03:43
created
app/components/Forms/BlockForm.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	/**
99
-	 * @param  array $defaults
99
+	 * @param  BlockEntity $defaults
100 100
 	 * @return self
101 101
 	 */
102 102
 	public function setDefaults(BlockEntity $defaults): self
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	/**
225
-	 * @param BlockRepository $blockRepository
225
+	 * @param BlockRepository $repository
226 226
 	 *
227 227
 	 * @return self
228 228
 	 */
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	}
243 243
 
244 244
 	/**
245
-	 * @param CategoryRepository $categoryRepository
245
+	 * @param CategoryRepository $repository
246 246
 	 *
247 247
 	 * @return self
248 248
 	 */
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function setDefaults(BlockEntity $defaults): self
103 103
 	{
104
-        $defaults = $this->guardDefaults($defaults);
104
+		$defaults = $this->guardDefaults($defaults);
105 105
 
106 106
 		$this['blockForm']->setDefaults($defaults->toArray());
107 107
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 			->setAttribute('size', 10)
141 141
 			->setAttribute('placeholder', 0);
142 142
 		$form->addCheckbox('program')
143
-		    ->setDefaultValue(1);
143
+			->setDefaultValue(1);
144 144
 		$form->addCheckbox('display_progs')
145 145
 			->setDefaultValue(0);
146 146
 		$form->addSelect('category', 'Kategorie:', $this->buildCategorySelect());
@@ -199,19 +199,19 @@  discard block
 block discarded – undo
199 199
 		return $selectContent;
200 200
 	}
201 201
 
202
-    /**
203
-     * @param  BlockEntity $defaults
204
-     * @return BlockEntity
205
-     */
202
+	/**
203
+	 * @param  BlockEntity $defaults
204
+	 * @return BlockEntity
205
+	 */
206 206
 	protected function guardDefaults(BlockEntity $defaults): BlockEntity
207
-    {
208
-        if(!array_key_exists($defaults->category, $this->buildCategorySelect()) )
209
-        {
210
-            $defaults->category = 0;
211
-        }
212
-
213
-        return $defaults;
214
-    }
207
+	{
208
+		if(!array_key_exists($defaults->category, $this->buildCategorySelect()) )
209
+		{
210
+			$defaults->category = 0;
211
+		}
212
+
213
+		return $defaults;
214
+	}
215 215
 
216 216
 	/**
217 217
 	 * @return BlockRepository
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * @var array
50 50
 	 */
51 51
 	protected $hours = [
52
-		0 => "00","01","02","03","04","05","06","07","08","09",
53
-			 "10","11","12","13","14","15","16","17","18","19",
54
-			 "20","21","22","23"
52
+		0 => "00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
53
+			 "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
54
+			 "20", "21", "22", "23"
55 55
 	];
56 56
 
57 57
 	/**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
 	protected function guardDefaults(BlockEntity $defaults): BlockEntity
207 207
     {
208
-        if(!array_key_exists($defaults->category, $this->buildCategorySelect()) )
208
+        if(!array_key_exists($defaults->category, $this->buildCategorySelect()))
209 209
         {
210 210
             $defaults->category = 0;
211 211
         }
Please login to merge, or discard this patch.
app/models/BlockModel.php 4 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,6 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * Return blocks that contents programs
114 114
 	 *
115 115
 	 * @param	int		meeting ID
116
+	 * @param integer $meetingId
116 117
 	 * @return	array	result and number of affected rows
117 118
 	 */
118 119
 	public function getProgramBlocks($meetingId)
@@ -269,7 +270,7 @@  discard block
 block discarded – undo
269 270
 	}
270 271
 
271 272
     /**
272
-     * @param  $block
273
+     * @param  BlockEntity $block
273 274
      * @return mixed
274 275
      */
275 276
 	public function transform($block)
@@ -290,7 +291,7 @@  discard block
 block discarded – undo
290 291
     }
291 292
 
292 293
     /**
293
-     * @param  $item
294
+     * @param  IEntity $item
294 295
      * @param  $id
295 296
      * @return mixed
296 297
      */
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -76,24 +76,24 @@  discard block
 block discarded – undo
76 76
 			->fetchAll();
77 77
 	}
78 78
 
79
-    /**
80
-     * @param  int $id
81
-     * @return BlockEntity
82
-     */
79
+	/**
80
+	 * @param  int $id
81
+	 * @return BlockEntity
82
+	 */
83 83
 	public function find($id): BlockEntity
84 84
 	{
85 85
 		$block = parent::find($id);
86 86
 		return $this->hydrate($block);
87 87
 	}
88 88
 
89
-    /**
90
-     * @param IEntity $entity
91
-     * @return bool|mixed
92
-     * @throws Exception
93
-     */
89
+	/**
90
+	 * @param IEntity $entity
91
+	 * @return bool|mixed
92
+	 * @throws Exception
93
+	 */
94 94
 	public function save(IEntity $entity)
95 95
 	{
96
-        $this->guardToGreaterThanFrom($entity->from, $entity->to);
96
+		$this->guardToGreaterThanFrom($entity->from, $entity->to);
97 97
 
98 98
 		if ($entity->getId() === null) {
99 99
 			$values = $entity->toArray();
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
 			->fetch();
252 252
 	}
253 253
 
254
-    /**
255
-     * @param  $values
256
-     * @return BlockEntity
257
-     */
254
+	/**
255
+	 * @param  $values
256
+	 * @return BlockEntity
257
+	 */
258 258
 	public function hydrate($values): BlockEntity
259 259
 	{
260 260
 		$entity = new BlockEntity();
@@ -268,32 +268,32 @@  discard block
 block discarded – undo
268 268
 		return $entity;
269 269
 	}
270 270
 
271
-    /**
272
-     * @param  $block
273
-     * @return mixed
274
-     */
271
+	/**
272
+	 * @param  $block
273
+	 * @return mixed
274
+	 */
275 275
 	public function transform($block)
276
-    {
277
-        $block->from = date('H:i:s', mktime($block->start_hour, $block->start_minute, 0, 0, 0, 0));
278
-        $block->to = date('H:i:s', mktime($block->end_hour, $block->end_minute, 0, 0, 0, 0));
279
-        $block->meeting = $this->getMeetingId();
280
-        $block->program = strval($block->program) ?: '0';
281
-        $block->display_progs = strval($block->display_progs) ?: '0';
282
-
283
-        unset($block->start_hour);
284
-        unset($block->end_hour);
285
-        unset($block->start_minute);
286
-        unset($block->end_minute);
287
-        unset($block->backlink);
288
-
289
-        return $block;
290
-    }
291
-
292
-    /**
293
-     * @param  $item
294
-     * @param  $id
295
-     * @return mixed
296
-     */
276
+	{
277
+		$block->from = date('H:i:s', mktime($block->start_hour, $block->start_minute, 0, 0, 0, 0));
278
+		$block->to = date('H:i:s', mktime($block->end_hour, $block->end_minute, 0, 0, 0, 0));
279
+		$block->meeting = $this->getMeetingId();
280
+		$block->program = strval($block->program) ?: '0';
281
+		$block->display_progs = strval($block->display_progs) ?: '0';
282
+
283
+		unset($block->start_hour);
284
+		unset($block->end_hour);
285
+		unset($block->start_minute);
286
+		unset($block->end_minute);
287
+		unset($block->backlink);
288
+
289
+		return $block;
290
+	}
291
+
292
+	/**
293
+	 * @param  $item
294
+	 * @param  $id
295
+	 * @return mixed
296
+	 */
297 297
 	private function setIdentity($item, $id)
298 298
 	{
299 299
 		$ref = new ClassType($item);
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 		return $item;
305 305
 	}
306 306
 
307
-    /**
308
-     * @param  date $from
309
-     * @param  date $to
310
-     * @return void
311
-     * @throws Exception
312
-     */
313
-    private function guardToGreaterThanFrom($from, $to)
314
-    {
315
-        if($from > $to) {
316
-            throw new Exception('Starting time is greater then finishing time.');
317
-        }
318
-    }
307
+	/**
308
+	 * @param  date $from
309
+	 * @param  date $to
310
+	 * @return void
311
+	 * @throws Exception
312
+	 */
313
+	private function guardToGreaterThanFrom($from, $to)
314
+	{
315
+		if($from > $to) {
316
+			throw new Exception('Starting time is greater then finishing time.');
317
+		}
318
+	}
319 319
 
320 320
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	{
96 96
         $this->guardToGreaterThanFrom($entity->from, $entity->to);
97 97
 
98
-		if ($entity->getId() === null) {
98
+		if($entity->getId() === null) {
99 99
 			$values = $entity->toArray();
100 100
 
101 101
 			$id = $this->create($values);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		//$this->setIdentity($entity, $values->id);
262 262
 
263 263
 		// unset($values['id']);
264
-		foreach ($values as $property => $value) {
264
+		foreach($values as $property => $value) {
265 265
 			$entity->$property = $value;
266 266
 		}
267 267
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@
 block discarded – undo
273 273
      * @return mixed
274 274
      */
275 275
 	public function transform($block)
276
-    {
276
+	{
277 277
         $block->from = date('H:i:s', mktime($block->start_hour, $block->start_minute, 0, 0, 0, 0));
278 278
         $block->to = date('H:i:s', mktime($block->end_hour, $block->end_minute, 0, 0, 0, 0));
279 279
         $block->meeting = $this->getMeetingId();
Please login to merge, or discard this patch.
app/models/IModel.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 block discarded – undo
14 14
 
15 15
 	/**
16 16
 	 * @param $id
17
-	 * @return mixed
17
+	 * @return \App\Entities\BlockEntity
18 18
 	 */
19 19
 	function find($id);
20 20
 
21 21
 	/**
22
-	 * @param array $values
22
+	 * @param array $value
23 23
 	 * @return mixed
24 24
 	 */
25 25
 	function findBy($column, $value);
Please login to merge, or discard this patch.
app/presenters/BasePresenter.php 2 patches
Doc Comments   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
 	/**
237
-	 * @return Container
237
+	 * @return Nette\DI\Container
238 238
 	 */
239 239
 	protected function getContainer()
240 240
 	{
@@ -355,6 +355,10 @@  discard block
 block discarded – undo
355 355
 		return $this->getModel()->updateBy('guid', $guid, $data);
356 356
 	}
357 357
 
358
+	/**
359
+	 * @param string $key
360
+	 * @param integer $minutes
361
+	 */
358 362
 	public function remember($key, $minutes, \Closure $callback)
359 363
 	{
360 364
 		// If the item exists in the cache we will just return this immediately
@@ -397,7 +401,7 @@  discard block
 block discarded – undo
397 401
 	}
398 402
 
399 403
 	/**
400
-	 * @return string
404
+	 * @return boolean
401 405
 	 */
402 406
 	protected function getDebugMode()
403 407
 	{
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			$this->setBacklink($backlink);
63 63
 		}
64 64
 
65
-		if($meetingId){
65
+		if($meetingId) {
66 66
 			$_SESSION['meetingID'] = $meetingId;
67 67
 		} elseif(!isset($_SESSION['meetingID'])) {
68 68
 			$meeting = $this->getContainer()->getService('meeting');
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
 		$template->expDir = EXP_DIR;
104 104
 		$template->meetDir = MEET_DIR;
105 105
 
106
-		$template->categories = $this->remember('categories:all', 10, function () {
106
+		$template->categories = $this->remember('categories:all', 10, function() {
107 107
 			return $this->getContainer()->getService('category')->all();
108 108
 		});
109 109
 
110
-		if(isset($_SESSION[SESSION_PREFIX.'user'])) {
111
-			$template->user = $this->getSunlight()->findUser($_SESSION[SESSION_PREFIX.'user']);
110
+		if(isset($_SESSION[SESSION_PREFIX . 'user'])) {
111
+			$template->user = $this->getSunlight()->findUser($_SESSION[SESSION_PREFIX . 'user']);
112 112
 		}
113 113
 		$template->meeting = $meeting->getPlaceAndYear($_SESSION['meetingID']);
114 114
 		$template->menuItems = $meeting->getMenuItems();
115
-		$template->meeting_heading	= $meeting->getRegHeading();
115
+		$template->meeting_heading = $meeting->getRegHeading();
116 116
 		$template->meetingId = $this->getMeetingId();
117 117
 		$template->backlinkUrl = $this->getBacklinkUrl();
118 118
 		$template->backlink = $this->getBacklink();
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
 		$i = 0;
199 199
 		$recipient = [];
200
-		foreach ($mails as $mail) {
200
+		foreach($mails as $mail) {
201 201
 			$mail = trim($mail);
202 202
 			$name = trim($names[$i]);
203 203
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	// zaheshovane udaje, aby se nedali jen tak ziskat data z databaze
213 213
 	protected function formKeyHash($id, $meetingId)
214 214
 	{
215
-		return ((int)$id . $meetingId) * 116 + 39147;
215
+		return ((int) $id . $meetingId) * 116 + 39147;
216 216
 	}
217 217
 
218 218
 	/**
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
 		// If the item exists in the cache we will just return this immediately
361 361
 		// otherwise we will execute the given Closure and cache the result
362 362
 		// of that execution for the given number of minutes in storage.
363
-		if (! is_null($data = $this->getCache()->load($key))) {
363
+		if(!is_null($data = $this->getCache()->load($key))) {
364 364
 			$items = [];
365 365
 
366 366
 			foreach($data as $item) {
367 367
 				$object = new \stdClass();
368
-				foreach ($item as $key => $value) {
368
+				foreach($item as $key => $value) {
369 369
 					$object->$key = $value;
370 370
 				}
371 371
 				$items[] = $object;
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 
377 377
 		$data = $callback();
378 378
 		$serialized = [];
379
-		foreach ($data as $item) {
379
+		foreach($data as $item) {
380 380
 			$serialized[] = $item->toArray();
381 381
 		}
382 382
 
Please login to merge, or discard this patch.
app/repositories/BlockRepository.php 1 patch
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 	/**
45 45
 	 * @param  int $id
46
-	 * @return \Nette\Database\Table\ActiveRow
46
+	 * @return BlockEntity
47 47
 	 */
48 48
 	public function find(int $id): BlockEntity
49 49
 	{
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	}
70 70
 
71 71
 	/**
72
-	 * @param  $block
72
+	 * @param  \Nette\Utils\ArrayHash $block
73 73
 	 * @return \Nette\Database\Table\ActiveRow
74 74
 	 */
75 75
 	public function create($block)
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 
85 85
 	/**
86
-	 * @param  $id
87
-	 * @param  $block
86
+	 * @param  integer $id
87
+	 * @param  \Nette\Utils\ArrayHash $block
88 88
 	 * @return \Nette\Database\Table\ActiveRow
89 89
 	 */
90 90
 	public function update($id, $block)
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	}
110 110
 
111 111
 	/**
112
-	 * @param $id
112
+	 * @param integer $id
113 113
 	 * @return bool
114 114
 	 */
115 115
 	public function delete($id): bool
Please login to merge, or discard this patch.
app/services/Emailer.php 1 patch
Doc Comments   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,6 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @param	string	subject
38 38
 	 * @param	string	message
39 39
 	 * @param	array	bcc
40
+	 * @param string $body
40 41
 	 * @return	bool	true | false (log the exception)
41 42
 	 */
42 43
 	public function sendMail($recipients, $subject, $body, array $bccMail = NULL)
@@ -103,7 +104,9 @@  discard block
 block discarded – undo
103 104
 	 * @param	array	recipient mail and name
104 105
 	 * @param	string	guid
105 106
 	 * @param	string	program | block
106
-	 * @return	mixed	true | error information
107
+	 * @param \Nette\Utils\ArrayHash[] $recipients
108
+	 * @param string $type
109
+	 * @return	boolean	true | error information
107 110
 	 */
108 111
 	public function tutor($recipients, $guid, $type)
109 112
 	{
@@ -132,7 +135,8 @@  discard block
 block discarded – undo
132 135
 	 * @param	array	recipient mail
133 136
 	 * @param	int		check hash code
134 137
 	 * @param	string	code for recognition of bank transaction
135
-	 * @return	mixed	true | error information
138
+	 * @param string $code4bank
139
+	 * @return	boolean	true | error information
136 140
 	 */
137 141
 	public function sendRegistrationSummary(array $recipientMail, $hash, $code4bank)
138 142
 	{
@@ -154,7 +158,8 @@  discard block
 block discarded – undo
154 158
 	 *
155 159
 	 * @param	mixed	id numbers in row
156 160
 	 * @param	string	type of template
157
-	 * @return	array	subject and message
161
+	 * @param string $type
162
+	 * @return	boolean	subject and message
158 163
 	 */
159 164
 	public function sendPaymentInfo($recipients, $type)
160 165
 	{
Please login to merge, or discard this patch.
app/presenters/BlockPresenter.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 			$this->logInfo('Destroying of block successfull, result: ' . json_encode($result));
132 132
 			$this->flashSuccess('Položka byla úspěšně smazána.');
133 133
 		} catch(Exception $e) {
134
-			$this->logError('Destroying of block failed, result: ' .  $e->getMessage());
134
+			$this->logError('Destroying of block failed, result: ' . $e->getMessage());
135 135
 			$this->flashFailure('Destroying of block failed, result: ' . $e->getMessage());
136 136
 		}
137 137
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			$this->logInfo('Sending email to block tutor successfull, result: ' . json_encode($recipients) . ', ' . $tutors->guid);
157 157
 			$this->flashSuccess('Email lektorovi byl odeslán..');
158 158
 		} catch(Exception $e) {
159
-			$this->logError('Sending email to block tutor failed, result: ' .  $e->getMessage());
159
+			$this->logError('Sending email to block tutor failed, result: ' . $e->getMessage());
160 160
 			$this->flashFailure('Email lektorovi nebyl odeslán, result: ' . $e->getMessage());
161 161
 		}
162 162
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	/**
26 26
 	 * @var integer
27 27
 	 */
28
-	private $blockId = NULL;
28
+	private $blockId = null;
29 29
 
30 30
 	/**
31 31
 	 * @var Emailer
Please login to merge, or discard this patch.
app/presenters/ProgramPresenter.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@
 block discarded – undo
124 124
 	public function actionCreate(ArrayHash $program)
125 125
 	{
126 126
 		try {
127
-		    $result = false;
127
+			$result = false;
128 128
 			$this->logInfo('Storing new program.');
129 129
 
130 130
 			$result = $this->getProgramRepository()->create($program);
Please login to merge, or discard this patch.
app/components/Forms/Factories/IProgramFormFactory.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
 interface IProgramFormFactory
11 11
 {
12 12
 
13
-    /**
14
-     * @return \App\Components\Forms\ProgramForm
15
-     */
16
-    public function create(): ProgramForm;
13
+	/**
14
+	 * @return \App\Components\Forms\ProgramForm
15
+	 */
16
+	public function create(): ProgramForm;
17 17
 
18 18
 }
Please login to merge, or discard this patch.