Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Web/THttpCookieCollection.php 1 patch
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -57,11 +57,12 @@  discard block
 block discarded – undo
57 57
 		if($item instanceof THttpCookie)
58 58
 		{
59 59
 			parent::insertAt($index, $item);
60
-			if($this->_o instanceof THttpResponse)
61
-				$this->_o->addCookie($item);
60
+			if($this->_o instanceof THttpResponse) {
61
+							$this->_o->addCookie($item);
62
+			}
63
+		} else {
64
+					throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required');
62 65
 		}
63
-		else
64
-			throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required');
65 66
 	}
66 67
 
67 68
 	/**
@@ -74,8 +75,9 @@  discard block
 block discarded – undo
74 75
 	public function removeAt($index)
75 76
 	{
76 77
 		$item = parent::removeAt($index);
77
-		if($this->_o instanceof THttpResponse)
78
-			$this->_o->removeCookie($item);
78
+		if($this->_o instanceof THttpResponse) {
79
+					$this->_o->removeCookie($item);
80
+		}
79 81
 		return $item;
80 82
 	}
81 83
 
@@ -85,10 +87,11 @@  discard block
 block discarded – undo
85 87
 	 */
86 88
 	public function itemAt($index)
87 89
 	{
88
-		if(is_int($index))
89
-			return parent::itemAt($index);
90
-		else
91
-			return $this->findCookieByName($index);
90
+		if(is_int($index)) {
91
+					return parent::itemAt($index);
92
+		} else {
93
+					return $this->findCookieByName($index);
94
+		}
92 95
 	}
93 96
 
94 97
 	/**
@@ -98,9 +101,10 @@  discard block
 block discarded – undo
98 101
 	 */
99 102
 	public function findCookieByName($name)
100 103
 	{
101
-		foreach($this as $cookie)
102
-			if($cookie->getName() === $name)
104
+		foreach($this as $cookie) {
105
+					if($cookie->getName() === $name)
103 106
 				return $cookie;
107
+		}
104 108
 		return null;
105 109
 	}
106 110
 }
107 111
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/TControlCollection.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		{
65 65
 			parent::insertAt($index, $item);
66 66
 			$this->_o->addedControl($item);
67
+		} elseif(is_string($item) || ($item instanceof IRenderable)) {
68
+					parent::insertAt($index, $item);
69
+		} else {
70
+					throw new TInvalidDataTypeException('controlcollection_control_required');
67 71
 		}
68
-		elseif(is_string($item) || ($item instanceof IRenderable))
69
-			parent::insertAt($index, $item);
70
-		else
71
-			throw new TInvalidDataTypeException('controlcollection_control_required');
72 72
 	}
73 73
 
74 74
 	/**
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 	public function removeAt($index)
82 82
 	{
83 83
 		$item = parent::removeAt($index);
84
-		if($item instanceof TControl)
85
-			$this->_o->removedControl($item);
84
+		if($item instanceof TControl) {
85
+					$this->_o->removedControl($item);
86
+		}
86 87
 		return $item;
87 88
 	}
88 89
 
@@ -92,7 +93,8 @@  discard block
 block discarded – undo
92 93
 	public function clear()
93 94
 	{
94 95
 		parent::clear();
95
-		if($this->_o instanceof INamingContainer)
96
-			$this->_o->clearNamingContainer();
96
+		if($this->_o instanceof INamingContainer) {
97
+					$this->_o->clearNamingContainer();
98
+		}
97 99
 	}
98 100
 }
99 101
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/TTheme.php 1 patch
Braces   +50 added lines, -40 removed lines patch added patch discarded remove patch
@@ -97,28 +97,29 @@  discard block
 block discarded – undo
97 97
 				list($skins, $cssFiles, $jsFiles, $timestamp) = $array;
98 98
 				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
99 99
 				{
100
-					if(($dir = opendir($themePath)) === false)
101
-						throw new TIOException('theme_path_inexistent', $themePath);
100
+					if(($dir = opendir($themePath)) === false) {
101
+											throw new TIOException('theme_path_inexistent', $themePath);
102
+					}
102 103
 					$cacheValid = true;
103 104
 					while(($file = readdir($dir)) !== false)
104 105
 					{
105
-						if($file === '.' || $file === '..')
106
-							continue;
107
-						elseif(basename($file, '.css') !== $file)
108
-							$this->_cssFiles[] = $themeUrl . '/' . $file;
109
-						elseif(basename($file, '.js') !== $file)
110
-							$this->_jsFiles[] = $themeUrl . '/' . $file;
111
-						elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp)
106
+						if($file === '.' || $file === '..') {
107
+													continue;
108
+						} elseif(basename($file, '.css') !== $file) {
109
+													$this->_cssFiles[] = $themeUrl . '/' . $file;
110
+						} elseif(basename($file, '.js') !== $file) {
111
+													$this->_jsFiles[] = $themeUrl . '/' . $file;
112
+						} elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp)
112 113
 						{
113 114
 							$cacheValid = false;
114 115
 							break;
115 116
 						}
116 117
 					}
117 118
 					closedir($dir);
118
-					if($cacheValid)
119
-						$this->_skins = $skins;
120
-				}
121
-				else
119
+					if($cacheValid) {
120
+											$this->_skins = $skins;
121
+					}
122
+				} else
122 123
 				{
123 124
 					$cacheValid = true;
124 125
 					$this->_cssFiles = $cssFiles;
@@ -132,30 +133,34 @@  discard block
 block discarded – undo
132 133
 			$this->_cssFiles = [];
133 134
 			$this->_jsFiles = [];
134 135
 			$this->_skins = [];
135
-			if(($dir = opendir($themePath)) === false)
136
-				throw new TIOException('theme_path_inexistent', $themePath);
136
+			if(($dir = opendir($themePath)) === false) {
137
+							throw new TIOException('theme_path_inexistent', $themePath);
138
+			}
137 139
 			while(($file = readdir($dir)) !== false)
138 140
 			{
139
-				if($file === '.' || $file === '..')
140
-					continue;
141
-				elseif(basename($file, '.css') !== $file)
142
-					$this->_cssFiles[] = $themeUrl . '/' . $file;
143
-				elseif(basename($file, '.js') !== $file)
144
-					$this->_jsFiles[] = $themeUrl . '/' . $file;
145
-				elseif(basename($file, self::SKIN_FILE_EXT) !== $file)
141
+				if($file === '.' || $file === '..') {
142
+									continue;
143
+				} elseif(basename($file, '.css') !== $file) {
144
+									$this->_cssFiles[] = $themeUrl . '/' . $file;
145
+				} elseif(basename($file, '.js') !== $file) {
146
+									$this->_jsFiles[] = $themeUrl . '/' . $file;
147
+				} elseif(basename($file, self::SKIN_FILE_EXT) !== $file)
146 148
 				{
147 149
 					$template = new TTemplate(file_get_contents($themePath . '/' . $file), $themePath, $themePath . '/' . $file);
148 150
 					foreach($template->getItems() as $skin)
149 151
 					{
150
-						if(!isset($skin[2]))  // a text string, ignored
152
+						if(!isset($skin[2])) {
153
+							// a text string, ignored
151 154
 							continue;
152
-						elseif($skin[0] !== -1)
153
-							throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath));
155
+						} elseif($skin[0] !== -1) {
156
+													throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath));
157
+						}
154 158
 						$type = $skin[1];
155 159
 						$id = isset($skin[2]['skinid'])?$skin[2]['skinid']:0;
156 160
 						unset($skin[2]['skinid']);
157
-						if(isset($this->_skins[$type][$id]))
158
-							throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath));
161
+						if(isset($this->_skins[$type][$id])) {
162
+													throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath));
163
+						}
159 164
 						/*
160 165
 						foreach($skin[2] as $name=>$value)
161 166
 						{
@@ -170,8 +175,9 @@  discard block
 block discarded – undo
170 175
 			closedir($dir);
171 176
 			sort($this->_cssFiles);
172 177
 			sort($this->_jsFiles);
173
-			if($cache !== null)
174
-				$cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]);
178
+			if($cache !== null) {
179
+							$cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]);
180
+			}
175 181
 		}
176 182
 	}
177 183
 
@@ -251,8 +257,9 @@  discard block
 block discarded – undo
251 257
 	public function applySkin($control)
252 258
 	{
253 259
 		$type = get_class($control);
254
-		if(($id = $control->getSkinID()) === '')
255
-			$id = 0;
260
+		if(($id = $control->getSkinID()) === '') {
261
+					$id = 0;
262
+		}
256 263
 		if(isset($this->_skins[$type][$id]))
257 264
 		{
258 265
 			foreach($this->_skins[$type][$id] as $name => $value)
@@ -287,29 +294,32 @@  discard block
 block discarded – undo
287 294
 				}
288 295
 				if(!is_array($value))
289 296
 				{
290
-					if(strpos($name, '.') === false)	// is simple property or custom attribute
297
+					if(strpos($name, '.') === false) {
298
+						// is simple property or custom attribute
291 299
 					{
292 300
 						if($control->hasProperty($name))
293 301
 						{
294 302
 							if($control->canSetProperty($name))
295 303
 							{
296 304
 								$setter = 'set' . $name;
305
+					}
297 306
 								$control->$setter($value);
307
+							} else {
308
+															throw new TConfigurationException('theme_property_readonly', $type, $name);
298 309
 							}
299
-							else
300
-								throw new TConfigurationException('theme_property_readonly', $type, $name);
310
+						} else {
311
+													throw new TConfigurationException('theme_property_undefined', $type, $name);
301 312
 						}
302
-						else
303
-							throw new TConfigurationException('theme_property_undefined', $type, $name);
304
-					}
305
-					else	// complex property
313
+					} else {
314
+						// complex property
306 315
 						$control->setSubProperty($name, $value);
316
+					}
307 317
 				}
308 318
 			}
309 319
 			return true;
320
+		} else {
321
+					return false;
310 322
 		}
311
-		else
312
-			return false;
313 323
 	}
314 324
 
315 325
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveTableRow.php 1 patch
Braces   +20 added lines, -13 removed lines patch added patch discarded remove patch
@@ -121,8 +121,9 @@  discard block
 block discarded – undo
121 121
 		{
122 122
 			$this->raiseCallbackEvent($param);
123 123
 			return true;
124
+		} else {
125
+			return false;
124 126
 		}
125
-		else return false;
126 127
 	}
127 128
 
128 129
 	/**
@@ -147,8 +148,9 @@  discard block
 block discarded – undo
147 148
 	{
148 149
 		parent::addAttributesToRender($writer);
149 150
 		$writer->addAttribute('id', $this->getClientID());
150
-		if ($this->hasEventHandler('OnRowSelected'))
151
-			$this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions());
151
+		if ($this->hasEventHandler('OnRowSelected')) {
152
+					$this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions());
153
+		}
152 154
 	}
153 155
 
154 156
 	/**
@@ -163,18 +165,19 @@  discard block
 block discarded – undo
163 165
 		if ($this->getHasPreRendered())
164 166
 		{
165 167
 			parent::render($writer);
166
-			if ($this->getActiveControl()->canUpdateClientSide())
167
-				$this->getPage()->getCallbackClient()->replaceContent($this, $writer);
168
-		}
169
-		else
168
+			if ($this->getActiveControl()->canUpdateClientSide()) {
169
+							$this->getPage()->getCallbackClient()->replaceContent($this, $writer);
170
+			}
171
+		} else
170 172
 		{
171 173
 			$this->getPage()->getAdapter()->registerControlToRender($this, $writer);
172 174
 			// If we update a TActiveTableRow on callback, we shouldn't update all childs,
173 175
 			// because the whole content will be replaced by the parent.
174 176
 			if ($this->getHasControls())
175 177
 			{
176
-				foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control)
177
-					$control->getActiveControl()->setEnableUpdate(false);
178
+				foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) {
179
+									$control->getActiveControl()->setEnableUpdate(false);
180
+				}
178 181
 			}
179 182
 		}
180 183
 	}
@@ -199,8 +202,9 @@  discard block
 block discarded – undo
199 202
 	 */
200 203
 	public function getRowIndex()
201 204
 	{
202
-		foreach ($this->getTable()->getRows() as $key => $row)
203
-			if ($row == $this) return $key;
205
+		foreach ($this->getTable()->getRows() as $key => $row) {
206
+					if ($row == $this) return $key;
207
+		}
204 208
 		throw new TConfigurationException('tactivetablerow_control_notincollection', get_class($this), $this->getUniqueID());
205 209
 	}
206 210
 
@@ -218,8 +222,11 @@  discard block
 block discarded – undo
218 222
 			{
219 223
 				$table = $table->getParent();
220 224
 			}
221
-			if ($table instanceof TTable) $this->_table = $table;
222
-			else throw new TConfigurationException('tactivetablerow_control_outoftable', get_class($this), $this->getUniqueID());
225
+			if ($table instanceof TTable) {
226
+				$this->_table = $table;
227
+			} else {
228
+				throw new TConfigurationException('tactivetablerow_control_outoftable', get_class($this), $this->getUniqueID());
229
+			}
223 230
 		}
224 231
 		return $this->_table;
225 232
 	}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveEditCommandColumn.php 1 patch
Braces   +12 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,20 +36,21 @@
 block discarded – undo
36 36
  */
37 37
 class TActiveEditCommandColumn extends TEditCommandColumn {
38 38
 	protected function createButton($commandName, $text, $causesValidation, $validationGroup) {
39
-		if($this->getButtonType() === TButtonColumnType::LinkButton)
40
-			$button = new TActiveLinkButton;
41
-		elseif($this->getButtonType() === TButtonColumnType::PushButton)
42
-				$button = new TActiveButton;
43
-			else  // image buttons
39
+		if($this->getButtonType() === TButtonColumnType::LinkButton) {
40
+					$button = new TActiveLinkButton;
41
+		} elseif($this->getButtonType() === TButtonColumnType::PushButton) {
42
+						$button = new TActiveButton;
43
+		} else  // image buttons
44 44
 			{
45 45
 				$button = new TActiveImageButton;
46 46
 				$button->setToolTip($text);
47
-				if(strcasecmp($commandName, 'Update') === 0)
48
-					$url = $this->getUpdateImageUrl();
49
-				elseif(strcasecmp($commandName, 'Cancel') === 0)
50
-						$url = $this->getCancelImageUrl();
51
-					else
52
-						$url = $this->getEditImageUrl();
47
+				if(strcasecmp($commandName, 'Update') === 0) {
48
+									$url = $this->getUpdateImageUrl();
49
+				} elseif(strcasecmp($commandName, 'Cancel') === 0) {
50
+										$url = $this->getCancelImageUrl();
51
+				} else {
52
+											$url = $this->getEditImageUrl();
53
+					}
53 54
 				$button->setImageUrl($url);
54 55
 			}
55 56
 		$button->setText($text);
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function flushContent()
61 61
 	{
62
-		foreach($this->_writers as $writer)
63
-			echo $writer->flush();
62
+		foreach($this->_writers as $writer) {
63
+					echo $writer->flush();
64
+		}
64 65
 		parent::flushContent();
65 66
 	}
66 67
 
@@ -86,8 +87,9 @@  discard block
 block discarded – undo
86 87
 	 */
87 88
 	public function httpRedirect($url)
88 89
 	{
89
-		if($url[0] === '/')
90
-			$url = $this->getRequest()->getBaseUrl() . $url;
90
+		if($url[0] === '/') {
91
+					$url = $this->getRequest()->getBaseUrl() . $url;
92
+		}
91 93
 		$this->_redirectUrl = str_replace('&', '&', $url);
92 94
 	}
93 95
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveControlAdapter.php 1 patch
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,13 +72,14 @@
 block discarded – undo
72 72
 	{
73 73
 		if($type === null)
74 74
 		{
75
-			if($this->getControl() instanceof ICallbackEventHandler)
76
-				$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl';
77
-			else
78
-				$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl';
75
+			if($this->getControl() instanceof ICallbackEventHandler) {
76
+							$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl';
77
+			} else {
78
+							$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl';
79
+			}
80
+		} else {
81
+					$this->_activeControlType = $type;
79 82
 		}
80
-		else
81
-			$this->_activeControlType = $type;
82 83
 	}
83 84
 
84 85
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveListBox.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,8 +89,9 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function setSelectionMode($value)
91 91
 	{
92
-		if(parent::getSelectionMode() === $value)
93
-			return;
92
+		if(parent::getSelectionMode() === $value) {
93
+					return;
94
+		}
94 95
 
95 96
 		parent::setSelectionMode($value);
96 97
 		$multiple = $this->getIsMultiSelect();
@@ -151,9 +152,10 @@  discard block
 block discarded – undo
151 152
 	{
152 153
 		parent::addAttributesToRender($writer);
153 154
 		$writer->addAttribute('id', $this->getClientID());
154
-		if ($this->getAutoPostBack())
155
-			$this->getActiveControl()->registerCallbackClientScript(
155
+		if ($this->getAutoPostBack()) {
156
+					$this->getActiveControl()->registerCallbackClientScript(
156 157
 				$this->getClientClassName(), $this->getPostBackOptions());
158
+		}
157 159
 	}
158 160
 }
159 161
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TCallbackClientSide.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -273,8 +273,9 @@
 block discarded – undo
273 273
 	 */
274 274
 	public function setPostBackTarget($value)
275 275
 	{
276
-		if($value instanceof TControl)
277
-			$value = $value->getUniqueID();
276
+		if($value instanceof TControl) {
277
+					$value = $value->getUniqueID();
278
+		}
278 279
 		$this->setOption('EventTarget', $value);
279 280
 	}
280 281
 
Please login to merge, or discard this patch.