Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Web/UI/ActiveControls/TStyleDiff.php 1 patch
Braces   +21 added lines, -16 removed lines patch added patch discarded remove patch
@@ -30,12 +30,14 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	protected function getCombinedStyle($obj)
32 32
 	{
33
-		if(!($obj instanceof TStyle))
34
-			return [];
33
+		if(!($obj instanceof TStyle)) {
34
+					return [];
35
+		}
35 36
 		$style = $obj->getStyleFields();
36 37
 		$style = array_merge($style, $this->getStyleFromString($obj->getCustomStyle()));
37
-		if($obj->hasFont())
38
-			$style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString()));
38
+		if($obj->hasFont()) {
39
+					$style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString()));
40
+		}
39 41
 		return $style;
40 42
 	}
41 43
 
@@ -46,13 +48,16 @@  discard block
 block discarded – undo
46 48
 	protected function getStyleFromString($string)
47 49
 	{
48 50
 		$style = [];
49
-		if(!is_string($string)) return $style;
51
+		if(!is_string($string)) {
52
+			return $style;
53
+		}
50 54
 
51 55
 		foreach(explode(';', $string) as $sub)
52 56
 		{
53 57
 			$arr = explode(':', $sub);
54
-			if(isset($arr[1]) && trim($arr[0]) !== '')
55
-				$style[trim($arr[0])] = trim($arr[1]);
58
+			if(isset($arr[1]) && trim($arr[0]) !== '') {
59
+							$style[trim($arr[0])] = trim($arr[1]);
60
+			}
56 61
 		}
57 62
 		return $style;
58 63
 	}
@@ -66,8 +71,7 @@  discard block
 block discarded – undo
66 71
 		{
67 72
 			return ($this->_new !== null) && $this->_new->hasCssClass()
68 73
 						? $this->_new->getCssClass() : null;
69
-		}
70
-		else
74
+		} else
71 75
 		{
72 76
 			return $this->_old->getCssClass() !== $this->_new->getCssClass() ?
73 77
 				$this->_new->getCssClass() : null;
@@ -90,16 +94,17 @@  discard block
 block discarded – undo
90 94
 	 */
91 95
 	public function getDifference()
92 96
 	{
93
-		if($this->_new === null)
94
-			return $this->_null;
95
-		else
97
+		if($this->_new === null) {
98
+					return $this->_null;
99
+		} else
96 100
 		{
97 101
 			$css = $this->getCssClassDiff();
98 102
 			$style = $this->getStyleDiff();
99
-			if(($css !== null) || ($style !== null))
100
-				return ['CssClass' => $css, 'Style' => $style];
101
-			else
102
-				$this->_null;
103
+			if(($css !== null) || ($style !== null)) {
104
+							return ['CssClass' => $css, 'Style' => $style];
105
+			} else {
106
+							$this->_null;
107
+			}
103 108
 		}
104 109
 	}
105 110
 }
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActivePager.php 1 patch
Braces   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -127,30 +127,30 @@  discard block
 block discarded – undo
127 127
 	{
128 128
 		if($buttonType === TPagerButtonType::LinkButton)
129 129
 		{
130
-			if($enabled)
131
-				$button = new TActiveLinkButton;
132
-			else
130
+			if($enabled) {
131
+							$button = new TActiveLinkButton;
132
+			} else
133 133
 			{
134 134
 				$button = new TLabel;
135 135
 				$button->setText($text);
136 136
 				$button->setCssClass($this->getButtonCssClass());
137 137
 				return $button;
138 138
 			}
139
-		}
140
-		elseif($buttonType === TPagerButtonType::ImageButton)
139
+		} elseif($buttonType === TPagerButtonType::ImageButton)
141 140
 		{
142 141
 			$button = new TActiveImageButton;
143 142
 			$button->setImageUrl($this->getPageImageUrl($text, $commandName));
144
-			if($enabled)
145
-				$button->Visible = true;
146
-			else
147
-				$button->Visible = false;
148
-		}
149
-		else
143
+			if($enabled) {
144
+							$button->Visible = true;
145
+			} else {
146
+							$button->Visible = false;
147
+			}
148
+		} else
150 149
 		{
151 150
 			$button = new TActiveButton;
152
-			if(!$enabled)
153
-				$button->setEnabled(false);
151
+			if(!$enabled) {
152
+							$button->setEnabled(false);
153
+			}
154 154
 		}
155 155
 
156 156
 		if($buttonType === TPagerButtonType::ImageButton)
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
 		{
205 205
 			$this->setDisplay(($this->getPageCount() == 1)?TDisplayStyle::None:TDisplayStyle::Dynamic);
206 206
 			TWebControl::render($writer);
207
-			if($this->getActiveControl()->canUpdateClientSide())
208
-				$this->getPage()->getCallbackClient()->replaceContent($this, $writer);
209
-		}
210
-		else
207
+			if($this->getActiveControl()->canUpdateClientSide()) {
208
+							$this->getPage()->getCallbackClient()->replaceContent($this, $writer);
209
+			}
210
+		} else
211 211
 		{
212 212
 			$this->getPage()->getAdapter()->registerControlToRender($this, $writer);
213 213
 		}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActivePageAdapter.php 1 patch
Braces   +31 added lines, -24 removed lines patch added patch discarded remove patch
@@ -120,8 +120,9 @@  discard block
 block discarded – undo
120 120
 	public function registerControlToRender($control, $writer)
121 121
 	{
122 122
 		$id = $control->getUniqueID();
123
-		if(!isset($this->_controlsToRender[$id]))
124
-			$this->_controlsToRender[$id] = [$control,$writer];
123
+		if(!isset($this->_controlsToRender[$id])) {
124
+					$this->_controlsToRender[$id] = [$control,$writer];
125
+		}
125 126
 	}
126 127
 
127 128
 	/**
@@ -139,10 +140,11 @@  discard block
 block discarded – undo
139 140
 	public function renderCallbackResponse($writer)
140 141
 	{
141 142
 		Prado::trace("ActivePage renderCallbackResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter');
142
-		if(($url = $this->getResponse()->getAdapter()->getRedirectedUrl()) === null)
143
-			$this->renderResponse($writer);
144
-		else
145
-			$this->redirect($url);
143
+		if(($url = $this->getResponse()->getAdapter()->getRedirectedUrl()) === null) {
144
+					$this->renderResponse($writer);
145
+		} else {
146
+					$this->redirect($url);
147
+		}
146 148
 	}
147 149
 
148 150
 	/**
@@ -164,8 +166,9 @@  discard block
 block discarded – undo
164 166
 	{
165 167
 		Prado::trace("ActivePage renderResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter');
166 168
 		//renders all the defered render() calls.
167
-		foreach($this->_controlsToRender as $rid => $forRender)
168
-			$forRender[0]->render($forRender[1]);
169
+		foreach($this->_controlsToRender as $rid => $forRender) {
170
+					$forRender[0]->render($forRender[1]);
171
+		}
169 172
 
170 173
 		$response = $this->getResponse();
171 174
 
@@ -212,23 +215,27 @@  discard block
 block discarded – undo
212 215
 
213 216
 		// collect all stylesheet file references
214 217
 		$stylesheets = $cs->getStyleSheetUrls();
215
-		if (count($stylesheets) > 0)
216
-		$this->appendContentPart($response, self::CALLBACK_STYLESHEETLIST_HEADER, TJavaScript::jsonEncode($stylesheets));
218
+		if (count($stylesheets) > 0) {
219
+				$this->appendContentPart($response, self::CALLBACK_STYLESHEETLIST_HEADER, TJavaScript::jsonEncode($stylesheets));
220
+		}
217 221
 
218 222
 		// collect all stylesheet snippets references
219 223
 		$stylesheets = $cs->getStyleSheetCodes();
220
-		if (count($stylesheets) > 0)
221
-		$this->appendContentPart($response, self::CALLBACK_STYLESHEET_HEADER, TJavaScript::jsonEncode($stylesheets));
224
+		if (count($stylesheets) > 0) {
225
+				$this->appendContentPart($response, self::CALLBACK_STYLESHEET_HEADER, TJavaScript::jsonEncode($stylesheets));
226
+		}
222 227
 
223 228
 		// collect all script file references
224 229
 		$scripts = $cs->getScriptUrls();
225
-		if (count($scripts) > 0)
226
-		$this->appendContentPart($response, self::CALLBACK_SCRIPTLIST_HEADER, TJavaScript::jsonEncode($scripts));
230
+		if (count($scripts) > 0) {
231
+				$this->appendContentPart($response, self::CALLBACK_SCRIPTLIST_HEADER, TJavaScript::jsonEncode($scripts));
232
+		}
227 233
 
228 234
 		// collect all hidden field references
229 235
 		$fields = $cs->getHiddenFields();
230
-		if (count($fields) > 0)
231
-		$this->appendContentPart($response, self::CALLBACK_HIDDENFIELDLIST_HEADER, TJavaScript::jsonEncode($fields));
236
+		if (count($fields) > 0) {
237
+				$this->appendContentPart($response, self::CALLBACK_HIDDENFIELDLIST_HEADER, TJavaScript::jsonEncode($fields));
238
+		}
232 239
 	}
233 240
 
234 241
 	/**
@@ -256,14 +263,12 @@  discard block
 block discarded – undo
256 263
 				$param = $this->getCallbackEventParameter();
257 264
 				$result = new TCallbackEventParameter($this->getResponse(), $param);
258 265
 				$callbackHandler->raiseCallbackEvent($result);
259
-			}
260
-			else
266
+			} else
261 267
 			{
262 268
 				throw new TInvalidCallbackException(
263 269
 					'callback_invalid_handler', $callbackHandler->getUniqueID());
264 270
 			}
265
-		 }
266
-		 else
271
+		 } else
267 272
 		 {
268 273
 			$target = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET);
269 274
 			throw new TInvalidCallbackException('callback_invalid_target', $target);
@@ -279,8 +284,9 @@  discard block
 block discarded – undo
279 284
 		if($this->_callbackEventTarget === null)
280 285
 		{
281 286
 			$eventTarget = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET);
282
-			if(!empty($eventTarget))
283
-				$this->_callbackEventTarget = $this->getPage()->findControl($eventTarget);
287
+			if(!empty($eventTarget)) {
288
+							$this->_callbackEventTarget = $this->getPage()->findControl($eventTarget);
289
+			}
284 290
 		}
285 291
 		return $this->_callbackEventTarget;
286 292
 	}
@@ -323,8 +329,9 @@  discard block
 block discarded – undo
323 329
 	 */
324 330
 	public function getCallbackClientHandler()
325 331
 	{
326
-		if($this->_callbackClient === null)
327
-			$this->_callbackClient = new TCallbackClientScript;
332
+		if($this->_callbackClient === null) {
333
+					$this->_callbackClient = new TCallbackClientScript;
334
+		}
328 335
 		return $this->_callbackClient;
329 336
 	}
330 337
 }
331 338
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TCallbackPageStateTracker.php 1 patch
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -109,8 +109,9 @@  discard block
 block discarded – undo
109 109
 			if($new !== $old)
110 110
 			{
111 111
 				$diff = new $details[0]($new, $old, $this->_nullObject);
112
-				if(($change = $diff->getDifference()) !== $this->_nullObject)
113
-					$changes[] = [$details[1],[$change]];
112
+				if(($change = $diff->getDifference()) !== $this->_nullObject) {
113
+									$changes[] = [$details[1],[$change]];
114
+				}
114 115
 			}
115 116
 		}
116 117
 		return $changes;
@@ -121,8 +122,9 @@  discard block
 block discarded – undo
121 122
 	 */
122 123
 	public function respondToChanges()
123 124
 	{
124
-		foreach($this->getChanges() as $change)
125
-			call_user_func_array($change[0], $change[1]);
125
+		foreach($this->getChanges() as $change) {
126
+					call_user_func_array($change[0], $change[1]);
127
+		}
126 128
 	}
127 129
 
128 130
 	/**
@@ -167,10 +169,11 @@  discard block
 block discarded – undo
167 169
 	 */
168 170
 	protected function updateVisible($visible)
169 171
 	{
170
-		if($visible === false)
171
-			$this->client()->replaceContent($this->_control, "<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\" ></span>");
172
-		else
173
-			$this->client()->replaceContent($this->_control, $this->_control);
172
+		if($visible === false) {
173
+					$this->client()->replaceContent($this->_control, "<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\" ></span>");
174
+		} else {
175
+					$this->client()->replaceContent($this->_control, $this->_control);
176
+		}
174 177
 	}
175 178
 
176 179
 	/**
@@ -188,10 +191,12 @@  discard block
 block discarded – undo
188 191
 	 */
189 192
 	protected function updateStyle($style)
190 193
 	{
191
-		if($style['CssClass'] !== null)
192
-			$this->client()->setAttribute($this->_control, 'class', $style['CssClass']);
193
-		if(is_array($style['Style']) && count($style['Style']) > 0)
194
-			$this->client()->setStyle($this->_control, $style['Style']);
194
+		if($style['CssClass'] !== null) {
195
+					$this->client()->setAttribute($this->_control, 'class', $style['CssClass']);
196
+		}
197
+		if(is_array($style['Style']) && count($style['Style']) > 0) {
198
+					$this->client()->setStyle($this->_control, $style['Style']);
199
+		}
195 200
 	}
196 201
 
197 202
 	/**
@@ -200,7 +205,8 @@  discard block
 block discarded – undo
200 205
 	 */
201 206
 	protected function updateAttributes($attributes)
202 207
 	{
203
-		foreach($attributes as $name => $value)
204
-			$this->client()->setAttribute($this->_control, $name, $value);
208
+		foreach($attributes as $name => $value) {
209
+					$this->client()->setAttribute($this->_control, $name, $value);
210
+		}
205 211
 	}
206 212
 }
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TCallbackOptions.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@
 block discarded – undo
40 40
 	 */
41 41
 	public function getClientSide()
42 42
 	{
43
-		if($this->_clientSide === null)
44
-			$this->_clientSide = $this->createClientSide();
43
+		if($this->_clientSide === null) {
44
+					$this->_clientSide = $this->createClientSide();
45
+		}
45 46
 		return $this->_clientSide;
46 47
 	}
47 48
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveCheckBox.php 1 patch
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -93,13 +93,15 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function setText($value)
95 95
 	{
96
-		if(parent::getText() === $value)
97
-			return;
96
+		if(parent::getText() === $value) {
97
+					return;
98
+		}
98 99
 
99 100
 		parent::setText($value);
100
-		if($this->getActiveControl()->canUpdateClientSide())
101
-			$this->getPage()->getCallbackClient()->update(
101
+		if($this->getActiveControl()->canUpdateClientSide()) {
102
+					$this->getPage()->getCallbackClient()->update(
102 103
 				$this->getDefaultLabelID(), $value);
104
+		}
103 105
 	}
104 106
 
105 107
 	/**
@@ -111,12 +113,14 @@  discard block
 block discarded – undo
111 113
 	public function setChecked($value)
112 114
 	{
113 115
 		$value = TPropertyValue::ensureBoolean($value);
114
-		if(parent::getChecked() === $value)
115
-			return;
116
+		if(parent::getChecked() === $value) {
117
+					return;
118
+		}
116 119
 
117 120
 		parent::setChecked($value);
118
-		if($this->getActiveControl()->canUpdateClientSide())
119
-			$this->getPage()->getCallbackClient()->check($this, $value);
121
+		if($this->getActiveControl()->canUpdateClientSide()) {
122
+					$this->getPage()->getCallbackClient()->check($this, $value);
123
+		}
120 124
 	}
121 125
 
122 126
 	/**
@@ -140,9 +144,10 @@  discard block
 block discarded – undo
140 144
 	protected function renderInputTag($writer, $clientID, $onclick)
141 145
 	{
142 146
 		parent::renderInputTag($writer, $clientID, $onclick);
143
-		if ($this->getAutoPostBack())
144
-			$this->getActiveControl()->registerCallbackClientScript(
147
+		if ($this->getAutoPostBack()) {
148
+					$this->getActiveControl()->registerCallbackClientScript(
145 149
 				$this->getClientClassName(), $this->getPostBackOptions());
150
+		}
146 151
 	}
147 152
 
148 153
 	/**
@@ -181,10 +186,11 @@  discard block
 block discarded – undo
181 186
 	 */
182 187
 	protected function getDefaultLabelID()
183 188
 	{
184
-		if($attributes = $this->getViewState('LabelAttributes', null))
185
-			return TCheckBox::getLabelAttributes()->itemAt('id');
186
-		else
187
-			return $this->getClientID() . '_label';
189
+		if($attributes = $this->getViewState('LabelAttributes', null)) {
190
+					return TCheckBox::getLabelAttributes()->itemAt('id');
191
+		} else {
192
+					return $this->getClientID() . '_label';
193
+		}
188 194
 	}
189 195
 }
190 196
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TBaseActiveControl.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@
 block discarded – undo
63 63
 	protected function setOption($name, $value, $default = null)
64 64
 	{
65 65
 		$value = ($value === null) ? $default : $value;
66
-		if($value !== null)
67
-			$this->_options->add($name, $value);
66
+		if($value !== null) {
67
+					$this->_options->add($name, $value);
68
+		}
68 69
 	}
69 70
 
70 71
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveTemplateColumn.php 1 patch
Braces   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -49,42 +49,41 @@
 block discarded – undo
49 49
 				$control->setData($text);
50 50
 			}
51 51
 			$cell->getControls()->add($control);
52
-		}
53
-		elseif($this->getAllowSorting()) {
52
+		} elseif($this->getAllowSorting()) {
54 53
 				$sortExpression = $this->getSortExpression();
55 54
 				if(($url = $this->getHeaderImageUrl()) !== '') {
56 55
 					$button = new TActiveImageButton;
57 56
 					$button->setImageUrl($url);
58 57
 					$button->setCommandName(TDataGrid::CMD_SORT);
59 58
 					$button->setCommandParameter($sortExpression);
60
-					if($text !== '')
61
-						$button->setAlternateText($text);
59
+					if($text !== '') {
60
+											$button->setAlternateText($text);
61
+					}
62 62
 					$button->setCausesValidation(false);
63 63
 					$cell->getControls()->add($button);
64
-				}
65
-				elseif($text !== '') {
64
+				} elseif($text !== '') {
66 65
 						$button = new TActiveLinkButton;
67 66
 						$button->setText($text);
68 67
 						$button->setCommandName(TDataGrid::CMD_SORT);
69 68
 						$button->setCommandParameter($sortExpression);
70 69
 						$button->setCausesValidation(false);
71 70
 						$cell->getControls()->add($button);
71
+					} else {
72
+											$cell->setText('&nbsp;');
72 73
 					}
73
-					else
74
-						$cell->setText('&nbsp;');
75
-			}
76
-			else {
74
+			} else {
77 75
 				if(($url = $this->getHeaderImageUrl()) !== '') {
78 76
 					$image = new TActiveImage;
79 77
 					$image->setImageUrl($url);
80
-					if($text !== '')
81
-						$image->setAlternateText($text);
78
+					if($text !== '') {
79
+											$image->setAlternateText($text);
80
+					}
82 81
 					$cell->getControls()->add($image);
83
-				}
84
-				elseif($text !== '')
85
-						$cell->setText($text);
86
-					else
87
-						$cell->setText('&nbsp;');
82
+				} elseif($text !== '') {
83
+										$cell->setText($text);
84
+				} else {
85
+											$cell->setText('&nbsp;');
86
+					}
88 87
 			}
89 88
 	}
90 89
 }
91 90
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveButtonColumn.php 1 patch
Braces   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	public function initializeCell($cell, $columnIndex, $itemType) {
35 35
 		if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) {
36 36
 			$buttonType = $this->getButtonType();
37
-			if($buttonType === TButtonColumnType::LinkButton)
38
-				$button = new TActiveLinkButton;
39
-			elseif($buttonType === TButtonColumnType::PushButton)
40
-					$button = new TActiveButton;
41
-				else // image button
37
+			if($buttonType === TButtonColumnType::LinkButton) {
38
+							$button = new TActiveLinkButton;
39
+			} elseif($buttonType === TButtonColumnType::PushButton) {
40
+								$button = new TActiveButton;
41
+			} else // image button
42 42
 				{
43 43
 					$button = new TActiveImageButton;
44 44
 					$button->setImageUrl($this->getImageUrl());
@@ -48,12 +48,13 @@  discard block
 block discarded – undo
48 48
 			$button->setCommandName($this->getCommandName());
49 49
 			$button->setCausesValidation($this->getCausesValidation());
50 50
 			$button->setValidationGroup($this->getValidationGroup());
51
-			if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== ''))
52
-				$button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']);
51
+			if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) {
52
+							$button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']);
53
+			}
53 54
 			$cell->getControls()->add($button);
54 55
 			$cell->registerObject('Button', $button);
56
+		} else {
57
+					parent::initializeCell($cell, $columnIndex, $itemType);
55 58
 		}
56
-		else
57
-			parent::initializeCell($cell, $columnIndex, $itemType);
58 59
 	}
59 60
 }
60 61
\ No newline at end of file
Please login to merge, or discard this patch.