Passed
Push — php-cs-fixer ( b9836a...b7e6c1 )
by Fabio
30:46 queued 14:47
created
framework/Web/UI/WebControls/TListBox.php 2 patches
Braces   +7 added lines, -10 removed lines patch added patch discarded remove patch
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
 				{
101 101
 					$this->setSelectedIndex($index);
102 102
 					return $this->_dataChanged = true;
103
-				}
104
-				else
103
+				} else
105 104
 					return false;
106 105
 			}
107 106
 			if(!is_array($selections))
108 107
 				$selections = [$selections];
109 108
 			$list = [];
110
-			foreach($selections as $selection)
111
-				$list[] = $items->findIndexByValue($selection, false);
109
+			foreach($selections as $selection) {
110
+							$list[] = $items->findIndexByValue($selection, false);
111
+			}
112 112
 			$list2 = $this->getSelectedIndices();
113 113
 			$n = count($list);
114 114
 			$flag = false;
@@ -123,8 +123,7 @@  discard block
 block discarded – undo
123 123
 						break;
124 124
 					}
125 125
 				}
126
-			}
127
-			else
126
+			} else
128 127
 				$flag = true;
129 128
 			if($flag)
130 129
 			{
@@ -132,13 +131,11 @@  discard block
 block discarded – undo
132 131
 				$this->_dataChanged = true;
133 132
 			}
134 133
 			return $flag;
135
-		}
136
-		elseif($this->getSelectedIndex() !== -1)
134
+		} elseif($this->getSelectedIndex() !== -1)
137 135
 		{
138 136
 			$this->clearSelection();
139 137
 			return $this->_dataChanged = true;
140
-		}
141
-		else
138
+		} else
142 139
 			return false;
143 140
 	}
144 141
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 		if(!$this->getEnabled(true))
89 89
 			return false;
90 90
 		$this->ensureDataBound();
91
-		$selections = isset($values[$key])?$values[$key]:null;
91
+		$selections = isset($values[$key]) ? $values[$key] : null;
92 92
 		if($selections !== null)
93 93
 		{
94 94
 			$items = $this->getItems();
95 95
 			if($this->getSelectionMode() === TListSelectionMode::Single)
96 96
 			{
97
-				$selection = is_array($selections)?$selections[0]:$selections;
97
+				$selection = is_array($selections) ? $selections[0] : $selections;
98 98
 				$index = $items->findIndexByValue($selection, false);
99 99
 				if($this->getSelectedIndex() !== $index)
100 100
 				{
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			if($n === count($list2))
116 116
 			{
117 117
 				sort($list, SORT_NUMERIC);
118
-				for($i = 0;$i < $n;++$i)
118
+				for($i = 0; $i < $n; ++$i)
119 119
 				{
120 120
 					if($list[$i] !== $list2[$i])
121 121
 					{
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDropDownList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 		if(!$this->getEnabled(true))
79 79
 			return false;
80 80
 		$this->ensureDataBound();
81
-		$selection = isset($values[$key])?$values[$key]:null;
81
+		$selection = isset($values[$key]) ? $values[$key] : null;
82 82
 		if($selection !== null)
83 83
 		{
84 84
 			$index = $this->getItems()->findIndexByValue($selection, false);
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TClientScript.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@
 block discarded – undo
126 126
 	 */
127 127
 	public function render($writer)
128 128
 	{
129
-		if ($this->getFlushScriptFiles())
129
+		if($this->getFlushScriptFiles())
130 130
 			$this->getPage()->getClientScript()->flushScriptFiles($writer, $this);
131 131
 		$this->renderCustomScriptFile($writer);
132 132
 		$this->renderCustomScript($writer);
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TWebControl.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -432,8 +432,9 @@
 block discarded – undo
432 432
 			$style->addAttributesToRender($writer);
433 433
 		if($this->getHasAttributes())
434 434
 		{
435
-			foreach($this->getAttributes() as $name => $value)
436
-				$writer->addAttribute($name, $value);
435
+			foreach($this->getAttributes() as $name => $value) {
436
+							$writer->addAttribute($name, $value);
437
+			}
437 438
 		}
438 439
 	}
439 440
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TOutputCacheTextWriterMulti.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,14 +36,16 @@
 block discarded – undo
36 36
 
37 37
 	public function write($s)
38 38
 	{
39
-		foreach($this->_writers as $writer)
40
-			$writer->write($s);
39
+		foreach($this->_writers as $writer) {
40
+					$writer->write($s);
41
+		}
41 42
 	}
42 43
 
43 44
 	public function flush()
44 45
 	{
45
-		foreach($this->_writers as $writer)
46
-			$s = $writer->flush();
46
+		foreach($this->_writers as $writer) {
47
+					$s = $writer->flush();
48
+		}
47 49
 		return $s;
48 50
 	}
49 51
 }
50 52
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TReCaptcha.php 3 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -254,8 +254,7 @@  discard block
 block discarded – undo
254 254
 				$writer->write($html);
255 255
 
256 256
 				$cs->registerEndScript('ReCaptcha::EventScript', 'jQuery(document).ready(function() { ' . $readyscript . '; } );');
257
-			}
258
-		else
257
+			} else
259 258
 			{
260 259
 				$options = $this->getClientSideOptions();
261 260
 				$options['callback'] = new TJavaScriptLiteral('function() { ' . $readyscript . '; ' . $this->getCallbackScript() . '; }');
@@ -308,8 +307,9 @@  discard block
 block discarded – undo
308 307
 	 */
309 308
 	private function recaptcha_qsencode ($data) {
310 309
 		$req = "";
311
-		foreach ($data as $key => $value)
312
-			$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
310
+		foreach ($data as $key => $value) {
311
+					$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
312
+		}
313 313
 
314 314
 		// Cut the last '&'
315 315
 		$req = substr($req, 0, strlen($req) - 1);
@@ -342,8 +342,10 @@  discard block
 block discarded – undo
342 342
 
343 343
 		fwrite($fs, $http_request);
344 344
 
345
-		while (!feof($fs))
346
-			$response .= fgets($fs, 1160); // One TCP-IP packet
345
+		while (!feof($fs)) {
346
+					$response .= fgets($fs, 1160);
347
+		}
348
+		// One TCP-IP packet
347 349
 		fclose($fs);
348 350
 		$response = explode("\r\n\r\n", $response, 2);
349 351
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -167,19 +167,18 @@  discard block
 block discarded – undo
167 167
 	public function getClientSideOptions()
168 168
 	{
169 169
 		$options = [];
170
-		if ($theme = $this->getThemeName())
170
+		if($theme = $this->getThemeName())
171 171
 			$options['theme'] = $theme;
172
-		if ($lang = $this->getLanguage())
172
+		if($lang = $this->getLanguage())
173 173
 			$options['lang'] = $lang;
174
-		if ($trans = $this->getCustomTranslations())
174
+		if($trans = $this->getCustomTranslations())
175 175
 			$options['custom_translations'] = $trans;
176 176
 		return $options;
177 177
 	}
178 178
 
179 179
 	public function validate()
180 180
 	{
181
-		if (!
182
-			  (
181
+		if(!(
183 182
 			($challenge = @$_POST[$this->getChallengeFieldName()])
184 183
 			and
185 184
 			($response = @$_POST[$this->getResponseFieldName()])
@@ -224,7 +223,7 @@  discard block
 block discarded – undo
224 223
 	{
225 224
 		// if we're in a callback, then schedule re-rendering of the control
226 225
 		// if not, don't do anything, because a new challenge will be rendered anyway
227
-		if ($this->Page->IsCallback)
226
+		if($this->Page->IsCallback)
228 227
 			$this->Page->CallbackClient->jQuery($this->getClientID() . ' #recaptcha_reload', 'click');
229 228
 	}
230 229
 
@@ -236,7 +235,7 @@  discard block
 block discarded – undo
236 235
 		$divid = $id . '_1_recaptchadiv';
237 236
 		$writer->write('<div id="' . htmlspecialchars($divid) . '">');
238 237
 	
239
-		if (!$this->Page->IsCallback)
238
+		if(!$this->Page->IsCallback)
240 239
 			{
241 240
 				$writer->write(TJavaScript::renderScriptBlock(
242 241
 					'var RecaptchaOptions = ' . TJavaScript::jsonEncode($this->getClientSideOptions()) . ';'
@@ -290,7 +289,7 @@  discard block
 block discarded – undo
290 289
 	{
291 290
 		$server = $use_ssl ? self::RECAPTCHA_API_SECURE_SERVER : $server = self::RECAPTCHA_API_SERVER;
292 291
 		$errorpart = '';
293
-		if ($error)
292
+		if($error)
294 293
 			$errorpart = "&amp;error=" . $error;
295 294
 
296 295
 		return '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
@@ -306,9 +305,9 @@  discard block
 block discarded – undo
306 305
 	 * @param $data - array of string elements to be encoded
307 306
 	 * @return string - encoded request
308 307
 	 */
309
-	private function recaptcha_qsencode ($data) {
308
+	private function recaptcha_qsencode($data) {
310 309
 		$req = "";
311
-		foreach ($data as $key => $value)
310
+		foreach($data as $key => $value)
312 311
 			$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
313 312
 
314 313
 		// Cut the last '&'
@@ -342,7 +341,7 @@  discard block
 block discarded – undo
342 341
 
343 342
 		fwrite($fs, $http_request);
344 343
 
345
-		while (!feof($fs))
344
+		while(!feof($fs))
346 345
 			$response .= fgets($fs, 1160); // One TCP-IP packet
347 346
 		fclose($fs);
348 347
 		$response = explode("\r\n\r\n", $response, 2);
@@ -362,7 +361,7 @@  discard block
 block discarded – undo
362 361
 	private function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $extra_params = [])
363 362
 	{
364 363
 		//discard spam submissions
365
-		if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0)
364
+		if($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0)
366 365
 			return false;
367 366
 
368 367
 		$response = $this->recaptcha_http_post(self::RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
@@ -376,7 +375,7 @@  discard block
 block discarded – undo
376 375
 
377 376
 		$answers = explode("\n", $response [1]);
378 377
 
379
-		if (trim($answers [0]) == 'true')
378
+		if(trim($answers [0]) == 'true')
380 379
 			return true;
381 380
 		else
382 381
 			return false;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -328,7 +328,7 @@
 block discarded – undo
328 328
 	{
329 329
 		$req = $this->recaptcha_qsencode($data);
330 330
 
331
-		$http_request = "POST $path HTTP/1.0\r\n";
331
+		$http_request = "post $path HTTP/1.0\r\n";
332 332
 		$http_request .= "Host: $host\r\n";
333 333
 		$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
334 334
 		$http_request .= "Content-Length: " . strlen($req) . "\r\n";
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TSlider.php 2 patches
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -301,8 +301,7 @@  discard block
 block discarded – undo
301 301
 		{
302 302
 			$this->setValue($value);
303 303
 			return $this->_dataChanged = true;
304
-		}
305
-		else
304
+		} else
306 305
 			return false;
307 306
 	}
308 307
 
@@ -474,8 +473,7 @@  discard block
 block discarded – undo
474 473
 				if ($value < $minValue) unset($values[$idx]);
475 474
 				if ($value > $maxValue) unset($values[$idx]);
476 475
 			}
477
-		}
478
-		else
476
+		} else
479 477
 		{
480 478
 			// Values are not provided, generate automatically using stepsize
481 479
 			$step = $this->getStepSize();
@@ -485,8 +483,9 @@  discard block
 block discarded – undo
485 483
 				$step = ($maxValue - $minValue) / self::MAX_STEPS;
486 484
 			}
487 485
 			$values = [];
488
-			for ($i = $minValue;$i <= $maxValue;$i += $step)
489
-				$values[] = $i;
486
+			for ($i = $minValue;$i <= $maxValue;$i += $step) {
487
+							$values[] = $i;
488
+			}
490 489
 			// Add max if it's not in the array because of step
491 490
 			if (!in_array($maxValue, $values)) $values[] = $maxValue;
492 491
 		}
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	/**
152 152
 	 * @return boolean wether to display a progress indicator or not. Defaults to true.
153 153
 	 */
154
-	public function getProgressIndicator ()
154
+	public function getProgressIndicator()
155 155
 	{
156 156
 		return $this->getViewState('ProgressIndicator', true);
157 157
 	}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	/**
160 160
 	 * @param boolean $value wether to display a progress indicator or not. Defaults to true.
161 161
 	 */
162
-	public function setProgressIndicator ($value)
162
+	public function setProgressIndicator($value)
163 163
 	{
164 164
 		$this->setViewState('ProgressIndicator', TPropertyValue::ensureBoolean($value), true);
165 165
 	}
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public function loadPostData($key, $values)
298 298
 	{
299
-		$value = (float)$values[$this->getClientID() . '_1'];
299
+		$value = (float) $values[$this->getClientID() . '_1'];
300 300
 		if($this->getValue() !== $value)
301 301
 		{
302 302
 			$this->setValue($value);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	/**
336 336
 	 * @return string the HTML tag name for slider. Defaults to div.
337 337
 	 */
338
-	public function getTagName ()
338
+	public function getTagName()
339 339
 	{
340 340
 		return "div";
341 341
 	}
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 	{
349 349
 		parent::addAttributesToRender($writer);
350 350
 		$writer->addAttribute('id', $this->getClientID());
351
-		if ($this->getCssClass() === '')
351
+		if($this->getCssClass() === '')
352 352
 		{
353
-			$class = ($this->getDirection() == TSliderDirection::Horizontal)?'HorizontalSlider':'VerticalSlider';
353
+			$class = ($this->getDirection() == TSliderDirection::Horizontal) ? 'HorizontalSlider' : 'VerticalSlider';
354 354
 			$writer->addAttribute('class', 'Slider ' . $class);
355 355
 		}
356 356
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		$writer->addAttribute('id', $this->getClientID() . '_track');
367 367
 		$writer->renderBeginTag('div');
368 368
 		// Render the 'Progress Indicator'
369
-		if ($this->getProgressIndicator())
369
+		if($this->getProgressIndicator())
370 370
 		{
371 371
 			$writer->addAttribute('class', 'Progress');
372 372
 			$writer->addAttribute('id', $this->getClientID() . '_progress');
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	 * This method is invoked right before the control rendering, if the control is visible.
404 404
 	 * @param mixed $param event parameter
405 405
 	 */
406
-	public function onPreRender ($param)
406
+	public function onPreRender($param)
407 407
 	{
408 408
 		parent::onPreRender($param);
409 409
 		$this->registerStyleSheet();
@@ -463,16 +463,16 @@  discard block
 block discarded – undo
463 463
 		$options['sliderValue'] = $this->getValue();
464 464
 		$options['disabled'] = !$this->getEnabled();
465 465
 		$values = $this->getValues();
466
-		if (!empty($values))
466
+		if(!empty($values))
467 467
 		{
468 468
 			// Values are provided. Check if min/max are present in them
469
-			if (!in_array($minValue, $values)) $values[] = $minValue;
470
-			if (!in_array($maxValue, $values)) $values[] = $maxValue;
469
+			if(!in_array($minValue, $values)) $values[] = $minValue;
470
+			if(!in_array($maxValue, $values)) $values[] = $maxValue;
471 471
 			// Remove all values outsize the range [min..max]
472
-			foreach ($values as $idx => $value)
472
+			foreach($values as $idx => $value)
473 473
 			{
474
-				if ($value < $minValue) unset($values[$idx]);
475
-				if ($value > $maxValue) unset($values[$idx]);
474
+				if($value < $minValue) unset($values[$idx]);
475
+				if($value > $maxValue) unset($values[$idx]);
476 476
 			}
477 477
 		}
478 478
 		else
@@ -480,15 +480,15 @@  discard block
 block discarded – undo
480 480
 			// Values are not provided, generate automatically using stepsize
481 481
 			$step = $this->getStepSize();
482 482
 			// We want at most self::MAX_STEPS values, so, change the step if necessary
483
-			if (($maxValue - $minValue) / $step > self::MAX_STEPS)
483
+			if(($maxValue - $minValue) / $step > self::MAX_STEPS)
484 484
 			{
485 485
 				$step = ($maxValue - $minValue) / self::MAX_STEPS;
486 486
 			}
487 487
 			$values = [];
488
-			for ($i = $minValue;$i <= $maxValue;$i += $step)
488
+			for($i = $minValue; $i <= $maxValue; $i += $step)
489 489
 				$values[] = $i;
490 490
 			// Add max if it's not in the array because of step
491
-			if (!in_array($maxValue, $values)) $values[] = $maxValue;
491
+			if(!in_array($maxValue, $values)) $values[] = $maxValue;
492 492
 		}
493 493
 		$options['values'] = $values;
494 494
 		if($this->_clientScript !== null)
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/THiddenField.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,9 @@
 block discarded – undo
68 68
 
69 69
 		if($this->getHasAttributes())
70 70
 		{
71
-			foreach($this->getAttributes() as $name => $value)
72
-				$writer->addAttribute($name, $value);
71
+			foreach($this->getAttributes() as $name => $value) {
72
+							$writer->addAttribute($name, $value);
73
+			}
73 74
 		}
74 75
 
75 76
 		$writer->renderBeginTag('input');
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TListControlValidator.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -145,8 +145,9 @@
 block discarded – undo
145 145
 		{
146 146
 			if($count < count($required))
147 147
 				return false;
148
-			foreach($required as $require)
149
-				$exists = $exists && in_array($require, $values);
148
+			foreach($required as $require) {
149
+							$exists = $exists && in_array($require, $values);
150
+			}
150 151
 		}
151 152
 
152 153
 		$min = $this->getMinSelection();
Please login to merge, or discard this patch.