Passed
Push — php-cs-fixer ( b9836a...b7e6c1 )
by Fabio
30:46 queued 14:47
created
framework/Wsat/pages/layout/TWsatLayout.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
 
22 22
 		private function validateSecurity()
23 23
 		{
24
-				if ($this->Session["wsat_password"] !== $this->getService()->getPassword())
24
+				if($this->Session["wsat_password"] !== $this->getService()->getPassword())
25 25
 				{
26
-						if (!$this->getPage() instanceof TWsatLogin)
26
+						if(!$this->getPage() instanceof TWsatLogin)
27 27
 						{
28 28
 								$url = $this->Service->constructUrl('TWsatLogin');
29 29
 								$this->Response->redirect($url);
Please login to merge, or discard this patch.
framework/Wsat/pages/TWsatLogin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
 		public function login()
20 20
 		{
21
-				if ($this->IsValid)
21
+				if($this->IsValid)
22 22
 				{
23 23
 						$this->Session["wsat_password"] = $this->getService()->getPassword();
24 24
 						$url = $this->Service->constructUrl('TWsatHome');
Please login to merge, or discard this patch.
framework/Wsat/TWsatService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@
 block discarded – undo
48 48
 
49 49
 		public function init($config)
50 50
 		{
51
-				if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal)
51
+				if($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal)
52 52
 						throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes.");
53 53
 
54
-				if (empty($this->_pass))
54
+				if(empty($this->_pass))
55 55
 						throw new TConfigurationException("You need to specify the Password attribute.");
56 56
 
57 57
 				$this->setDefaultPage("TWsatHome");
Please login to merge, or discard this patch.
framework/Wsat/TWsatARGenerator.php 3 patches
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -107,9 +107,11 @@  discard block
 block discarded – undo
107 107
 								];
108 108
 								continue;
109 109
 						}
110
-						foreach ($fks as $fk_data)//1-M relationships
110
+						foreach ($fks as $fk_data) {
111
+							//1-M relationships
111 112
 						{
112 113
 								$owner_table = $fk_data["table"];
114
+						}
113 115
 								$slave_table = $table_name;
114 116
 								$fk_prop = key($fk_data["keys"]);
115 117
 
@@ -141,8 +143,9 @@  discard block
 block discarded – undo
141 143
 				else
142 144
 				{
143 145
 						$properties = [];
144
-						foreach ($tableInfo->getColumns() as $field => $metadata)
145
-								$properties[] = $this->generateProperty($field, $metadata);
146
+						foreach ($tableInfo->getColumns() as $field => $metadata) {
147
+														$properties[] = $this->generateProperty($field, $metadata);
148
+						}
146 149
 						$toString = $this->_buildSmartToString($tableInfo);
147 150
 				}
148 151
 
@@ -179,8 +182,9 @@  discard block
 block discarded – undo
179 182
 						return "";
180 183
 
181 184
 				$code = "\tpublic static \$RELATIONS = array (";
182
-				foreach ($this->_relations[$tablename] as $rel_data)
183
-						$code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
185
+				foreach ($this->_relations[$tablename] as $rel_data) {
186
+										$code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
187
+				}
184 188
 
185 189
 				$code = substr($code, 0, -1);
186 190
 				$code .= "\n\t);";
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 
66 66
 		public function generateAll()
67 67
 		{
68
-				foreach ($this->getAllTableNames() as $tableName)
68
+				foreach($this->getAllTableNames() as $tableName)
69 69
 				{
70 70
 						$tableInfo = $this->_dbMetaData->getTableInfo($tableName);
71
-						if (!empty($this->_relations))
71
+						if(!empty($this->_relations))
72 72
 						{
73 73
 								// Cancel generation of M-M relationships middle table
74
-								if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
74
+								if(count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
75 75
 										continue;
76 76
 						}
77 77
 						$this->_commonGenerate($tableName, $tableInfo);
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 		public function buildRelations()
82 82
 		{
83 83
 				$this->_relations = [];
84
-				foreach ($this->getAllTableNames() as $table_name)
84
+				foreach($this->getAllTableNames() as $table_name)
85 85
 				{
86 86
 						$tableInfo = $this->_dbMetaData->getTableInfo($table_name);
87 87
 						$pks = $tableInfo->getPrimaryKeys();
88 88
 						$fks = $tableInfo->getForeignKeys();
89 89
 
90
-						if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
90
+						if(count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
91 91
 						{
92 92
 								$table_name_mm = $fks[0]["table"];
93 93
 								$table_name_mm2 = $fks[1]["table"];
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 								];
108 108
 								continue;
109 109
 						}
110
-						foreach ($fks as $fk_data)//1-M relationships
110
+						foreach($fks as $fk_data)//1-M relationships
111 111
 						{
112 112
 								$owner_table = $fk_data["table"];
113 113
 								$slave_table = $table_name;
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 
137 137
 		private function _commonGenerate($tableName, $tableInfo)
138 138
 		{
139
-				if (count($tableInfo->getColumns()) === 0)
139
+				if(count($tableInfo->getColumns()) === 0)
140 140
 						throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
141 141
 				else
142 142
 				{
143 143
 						$properties = [];
144
-						foreach ($tableInfo->getColumns() as $field => $metadata)
144
+						foreach($tableInfo->getColumns() as $field => $metadata)
145 145
 								$properties[] = $this->generateProperty($field, $metadata);
146 146
 						$toString = $this->_buildSmartToString($tableInfo);
147 147
 				}
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 
176 176
 		private function _renderRelations($tablename)
177 177
 		{
178
-				if (!isset($this->_relations[$tablename]))
178
+				if(!isset($this->_relations[$tablename]))
179 179
 						return "";
180 180
 
181 181
 				$code = "\tpublic static \$RELATIONS = array (";
182
-				foreach ($this->_relations[$tablename] as $rel_data)
182
+				foreach($this->_relations[$tablename] as $rel_data)
183 183
 						$code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
184 184
 
185 185
 				$code = substr($code, 0, -1);
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 				$property = "throw new THttpException(500, 'Not implemented yet.');";
194 194
 				try
195 195
 				{
196
-						foreach ($tableInfo->getColumns() as $column)
196
+						foreach($tableInfo->getColumns() as $column)
197 197
 						{
198
-								if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
198
+								if(isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
199 199
 										$property = str_replace($this->uqChars, "", $column->ColumnName);
200
-								elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
200
+								elseif($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
201 201
 								{
202 202
 										$property = str_replace($this->uqChars, "", $column->ColumnName);
203 203
 										break;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@
 block discarded – undo
238 238
 
239 239
 $toString
240 240
 }
241
-EOD;
241
+eod;
242 242
 		}
243 243
 
244 244
 // </editor-fold>
Please login to merge, or discard this patch.
framework/IO/TTarFileExtractor.php 2 patches
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -157,8 +157,9 @@  discard block
 block discarded – undo
157 157
 				$this->_temp_tarname = '';
158 158
 				return false;
159 159
 			  }
160
-			  while ($v_data = @fread($v_file_from, 1024))
161
-				  @fwrite($v_file_to, $v_data);
160
+			  while ($v_data = @fread($v_file_from, 1024)) {
161
+			  				  @fwrite($v_file_to, $v_data);
162
+			  }
162 163
 			  @fclose($v_file_from);
163 164
 			  @fclose($v_file_to);
164 165
 		  }
@@ -253,14 +254,17 @@  discard block
 block discarded – undo
253 254
 		// ----- Calculate the checksum
254 255
 		$v_checksum = 0;
255 256
 		// ..... First part of the header
256
-		for ($i = 0; $i < 148; $i++)
257
-			$v_checksum += ord(substr($v_binary_data, $i, 1));
257
+		for ($i = 0; $i < 148; $i++) {
258
+					$v_checksum += ord(substr($v_binary_data, $i, 1));
259
+		}
258 260
 		// ..... Ignore the checksum value and replace it by ' ' (space)
259
-		for ($i = 148; $i < 156; $i++)
260
-			$v_checksum += ord(' ');
261
+		for ($i = 148; $i < 156; $i++) {
262
+					$v_checksum += ord(' ');
263
+		}
261 264
 		// ..... Last part of the header
262
-		for ($i = 156; $i < 512; $i++)
263
-		   $v_checksum += ord(substr($v_binary_data, $i, 1));
265
+		for ($i = 156; $i < 512; $i++) {
266
+				   $v_checksum += ord(substr($v_binary_data, $i, 1));
267
+		}
264 268
 
265 269
 		$v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"
266 270
 						 . "a8checksum/a1typeflag/a100link/a6magic/a2version/"
@@ -412,8 +416,9 @@  discard block
 block discarded – undo
412 416
 		  $v_header['filename'] = substr($v_header['filename'],
413 417
 										 $p_remove_path_size);
414 418
 		if (($p_path != './') && ($p_path != '/')) {
415
-		  while (substr($p_path, -1) == '/')
416
-			$p_path = substr($p_path, 0, strlen($p_path) - 1);
419
+		  while (substr($p_path, -1) == '/') {
420
+		  			$p_path = substr($p_path, 0, strlen($p_path) - 1);
421
+		  }
417 422
 
418 423
 		  if (substr($v_header['filename'], 0, 1) == '/')
419 424
 			  $v_header['filename'] = $p_path . $v_header['filename'];
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	{
70 70
 		$this->_close();
71 71
 		// ----- Look for a local copy to delete
72
-		if ($this->_temp_tarname != '')
72
+		if($this->_temp_tarname != '')
73 73
 			@unlink($this->_temp_tarname);
74 74
 	}
75 75
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		$v_result = true;
116 116
 		$v_list_detail = [];
117 117
 
118
-		if ($v_result = $this->_openRead()) {
118
+		if($v_result = $this->_openRead()) {
119 119
 			$v_result = $this->_extractList($p_path, $v_list_detail,
120 120
 											"complete", 0, $p_remove_path);
121 121
 			$this->_close();
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 	private function _isArchive($p_filename = null)
133 133
 	{
134
-		if ($p_filename == null) {
134
+		if($p_filename == null) {
135 135
 			$p_filename = $this->_tarname;
136 136
 		}
137 137
 		clearstatcache();
@@ -140,24 +140,24 @@  discard block
 block discarded – undo
140 140
 
141 141
 	private function _openRead()
142 142
 	{
143
-		if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') {
143
+		if(strtolower(substr($this->_tarname, 0, 7)) == 'http://') {
144 144
 
145 145
 		  // ----- Look if a local copy need to be done
146
-		  if ($this->_temp_tarname == '') {
146
+		  if($this->_temp_tarname == '') {
147 147
 			  $this->_temp_tarname = uniqid('tar') . '.tmp';
148
-			  if (!$v_file_from = @fopen($this->_tarname, 'rb')) {
148
+			  if(!$v_file_from = @fopen($this->_tarname, 'rb')) {
149 149
 				$this->_error('Unable to open in read mode \''
150 150
 							  . $this->_tarname . '\'');
151 151
 				$this->_temp_tarname = '';
152 152
 				return false;
153 153
 			  }
154
-			  if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
154
+			  if(!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
155 155
 				$this->_error('Unable to open in write mode \''
156 156
 							  . $this->_temp_tarname . '\'');
157 157
 				$this->_temp_tarname = '';
158 158
 				return false;
159 159
 			  }
160
-			  while ($v_data = @fread($v_file_from, 1024))
160
+			  while($v_data = @fread($v_file_from, 1024))
161 161
 				  @fwrite($v_file_to, $v_data);
162 162
 			  @fclose($v_file_from);
163 163
 			  @fclose($v_file_to);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 		$this->_file = @fopen($v_filename, "rb");
174 174
 
175
-		if ($this->_file == 0) {
175
+		if($this->_file == 0) {
176 176
 			$this->_error('Unable to open in read mode \'' . $v_filename . '\'');
177 177
 			return false;
178 178
 		}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	private function _close()
184 184
 	{
185 185
 		//if (isset($this->_file)) {
186
-		if (is_resource($this->_file))
186
+		if(is_resource($this->_file))
187 187
 		{
188 188
 			   @fclose($this->_file);
189 189
 			$this->_file = 0;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
 		// ----- Look if a local copy need to be erase
193 193
 		// Note that it might be interesting to keep the url for a time : ToDo
194
-		if ($this->_temp_tarname != '') {
194
+		if($this->_temp_tarname != '') {
195 195
 			@unlink($this->_temp_tarname);
196 196
 			$this->_temp_tarname = '';
197 197
 		}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		$this->_close();
205 205
 
206 206
 		// ----- Look for a local copy
207
-		if ($this->_temp_tarname != '') {
207
+		if($this->_temp_tarname != '') {
208 208
 			// ----- Remove the local copy but not the remote tarname
209 209
 			@unlink($this->_temp_tarname);
210 210
 			$this->_temp_tarname = '';
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	private function _readBlock()
221 221
 	{
222 222
 	  $v_block = null;
223
-	  if (is_resource($this->_file)) {
223
+	  if(is_resource($this->_file)) {
224 224
 			  $v_block = @fread($this->_file, 512);
225 225
 	  }
226 226
 	  return $v_block;
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 
229 229
 	private function _jumpBlock($p_len = null)
230 230
 	{
231
-	  if (is_resource($this->_file)) {
232
-		  if ($p_len === null)
231
+	  if(is_resource($this->_file)) {
232
+		  if($p_len === null)
233 233
 			  $p_len = 1;
234 234
 
235 235
 			  @fseek($this->_file, @ftell($this->_file) + ($p_len * 512));
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
 
240 240
 	private function _readHeader($v_binary_data, &$v_header)
241 241
 	{
242
-		if (strlen($v_binary_data) == 0) {
242
+		if(strlen($v_binary_data) == 0) {
243 243
 			$v_header['filename'] = '';
244 244
 			return true;
245 245
 		}
246 246
 
247
-		if (strlen($v_binary_data) != 512) {
247
+		if(strlen($v_binary_data) != 512) {
248 248
 			$v_header['filename'] = '';
249 249
 			$this->_error('Invalid block size : ' . strlen($v_binary_data));
250 250
 			return false;
@@ -253,13 +253,13 @@  discard block
 block discarded – undo
253 253
 		// ----- Calculate the checksum
254 254
 		$v_checksum = 0;
255 255
 		// ..... First part of the header
256
-		for ($i = 0; $i < 148; $i++)
256
+		for($i = 0; $i < 148; $i++)
257 257
 			$v_checksum += ord(substr($v_binary_data, $i, 1));
258 258
 		// ..... Ignore the checksum value and replace it by ' ' (space)
259
-		for ($i = 148; $i < 156; $i++)
259
+		for($i = 148; $i < 156; $i++)
260 260
 			$v_checksum += ord(' ');
261 261
 		// ..... Last part of the header
262
-		for ($i = 156; $i < 512; $i++)
262
+		for($i = 156; $i < 512; $i++)
263 263
 		   $v_checksum += ord(substr($v_binary_data, $i, 1));
264 264
 
265 265
 		$v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 
270 270
 		// ----- Extract the checksum
271 271
 		$v_header['checksum'] = OctDec(trim($v_data['checksum']));
272
-		if ($v_header['checksum'] != $v_checksum) {
272
+		if($v_header['checksum'] != $v_checksum) {
273 273
 			$v_header['filename'] = '';
274 274
 
275 275
 			// ----- Look for last block (empty block)
276
-			if (($v_checksum == 256) && ($v_header['checksum'] == 0))
276
+			if(($v_checksum == 256) && ($v_header['checksum'] == 0))
277 277
 				return true;
278 278
 
279 279
 			$this->_error('Invalid checksum for file "' . $v_data['filename']
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		$v_header['gid'] = OctDec(trim($v_data['gid']));
290 290
 		$v_header['size'] = OctDec(trim($v_data['size']));
291 291
 		$v_header['mtime'] = OctDec(trim($v_data['mtime']));
292
-		if (($v_header['typeflag'] = $v_data['typeflag']) == "5") {
292
+		if(($v_header['typeflag'] = $v_data['typeflag']) == "5") {
293 293
 		  $v_header['size'] = 0;
294 294
 		}
295 295
 		return true;
@@ -299,11 +299,11 @@  discard block
 block discarded – undo
299 299
 	{
300 300
 	  $v_filename = '';
301 301
 	  $n = floor($v_header['size'] / 512);
302
-	  for ($i = 0; $i < $n; $i++) {
302
+	  for($i = 0; $i < $n; $i++) {
303 303
 		$v_content = $this->_readBlock();
304 304
 		$v_filename .= $v_content;
305 305
 	  }
306
-	  if (($v_header['size'] % 512) != 0) {
306
+	  if(($v_header['size'] % 512) != 0) {
307 307
 		$v_content = $this->_readBlock();
308 308
 		$v_filename .= $v_content;
309 309
 	  }
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	  // ----- Read the next header
312 312
 	  $v_binary_data = $this->_readBlock();
313 313
 
314
-	  if (!$this->_readHeader($v_binary_data, $v_header))
314
+	  if(!$this->_readHeader($v_binary_data, $v_header))
315 315
 		return false;
316 316
 
317 317
 	  $v_header['filename'] = $v_filename;
@@ -328,18 +328,18 @@  discard block
 block discarded – undo
328 328
 	$v_listing = false;
329 329
 
330 330
 	$p_path = $this->_translateWinPath($p_path, false);
331
-	if ($p_path == '' || (substr($p_path, 0, 1) != '/'
331
+	if($p_path == '' || (substr($p_path, 0, 1) != '/'
332 332
 		&& substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
333 333
 	  $p_path = "./" . $p_path;
334 334
 	}
335 335
 	$p_remove_path = $this->_translateWinPath($p_remove_path);
336 336
 
337 337
 	// ----- Look for path to remove format (should end by /)
338
-	if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
338
+	if(($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
339 339
 	  $p_remove_path .= '/';
340 340
 	$p_remove_path_size = strlen($p_remove_path);
341 341
 
342
-	switch ($p_mode) {
342
+	switch($p_mode) {
343 343
 	  case "complete" :
344 344
 		$v_extract_all = true;
345 345
 		$v_listing = false;
@@ -359,33 +359,33 @@  discard block
 block discarded – undo
359 359
 
360 360
 	clearstatcache();
361 361
 
362
-	while (strlen($v_binary_data = $this->_readBlock()) != 0)
362
+	while(strlen($v_binary_data = $this->_readBlock()) != 0)
363 363
 	{
364 364
 	  $v_extract_file = false;
365 365
 	  $v_extraction_stopped = 0;
366 366
 
367
-	  if (!$this->_readHeader($v_binary_data, $v_header))
367
+	  if(!$this->_readHeader($v_binary_data, $v_header))
368 368
 		return false;
369 369
 
370
-	  if ($v_header['filename'] == '') {
370
+	  if($v_header['filename'] == '') {
371 371
 		continue;
372 372
 	  }
373 373
 
374 374
 	  // ----- Look for long filename
375
-	  if ($v_header['typeflag'] == 'L') {
376
-		if (!$this->_readLongHeader($v_header))
375
+	  if($v_header['typeflag'] == 'L') {
376
+		if(!$this->_readLongHeader($v_header))
377 377
 		  return false;
378 378
 	  }
379 379
 
380
-	  if ((!$v_extract_all) && (is_array($p_file_list))) {
380
+	  if((!$v_extract_all) && (is_array($p_file_list))) {
381 381
 		// ----- By default no unzip if the file is not found
382 382
 		$v_extract_file = false;
383 383
 
384
-		for ($i = 0; $i < count($p_file_list); $i++) {
384
+		for($i = 0; $i < count($p_file_list); $i++) {
385 385
 		  // ----- Look if it is a directory
386
-		  if (substr($p_file_list[$i], -1) == '/') {
386
+		  if(substr($p_file_list[$i], -1) == '/') {
387 387
 			// ----- Look if the directory is in the filename path
388
-			if ((strlen($v_header['filename']) > strlen($p_file_list[$i]))
388
+			if((strlen($v_header['filename']) > strlen($p_file_list[$i]))
389 389
 				&& (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
390 390
 					== $p_file_list[$i])) {
391 391
 			  $v_extract_file = true;
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 		  }
395 395
 
396 396
 		  // ----- It is a file, so compare the file names
397
-		  elseif ($p_file_list[$i] == $v_header['filename']) {
397
+		  elseif($p_file_list[$i] == $v_header['filename']) {
398 398
 			$v_extract_file = true;
399 399
 			break;
400 400
 		  }
@@ -404,58 +404,58 @@  discard block
 block discarded – undo
404 404
 	  }
405 405
 
406 406
 	  // ----- Look if this file need to be extracted
407
-	  if (($v_extract_file) && (!$v_listing))
407
+	  if(($v_extract_file) && (!$v_listing))
408 408
 	  {
409
-		if (($p_remove_path != '')
409
+		if(($p_remove_path != '')
410 410
 			&& (substr($v_header['filename'], 0, $p_remove_path_size)
411 411
 				== $p_remove_path))
412 412
 		  $v_header['filename'] = substr($v_header['filename'],
413 413
 										 $p_remove_path_size);
414
-		if (($p_path != './') && ($p_path != '/')) {
415
-		  while (substr($p_path, -1) == '/')
414
+		if(($p_path != './') && ($p_path != '/')) {
415
+		  while(substr($p_path, -1) == '/')
416 416
 			$p_path = substr($p_path, 0, strlen($p_path) - 1);
417 417
 
418
-		  if (substr($v_header['filename'], 0, 1) == '/')
418
+		  if(substr($v_header['filename'], 0, 1) == '/')
419 419
 			  $v_header['filename'] = $p_path . $v_header['filename'];
420 420
 		  else
421 421
 			$v_header['filename'] = $p_path . '/' . $v_header['filename'];
422 422
 		}
423
-		if (file_exists($v_header['filename'])) {
424
-		  if ((@is_dir($v_header['filename']))
423
+		if(file_exists($v_header['filename'])) {
424
+		  if((@is_dir($v_header['filename']))
425 425
 			  && ($v_header['typeflag'] == '')) {
426 426
 			$this->_error('File ' . $v_header['filename']
427 427
 						  . ' already exists as a directory');
428 428
 			return false;
429 429
 		  }
430
-		  if (($this->_isArchive($v_header['filename']))
430
+		  if(($this->_isArchive($v_header['filename']))
431 431
 			  && ($v_header['typeflag'] == "5")) {
432 432
 			$this->_error('Directory ' . $v_header['filename']
433 433
 						  . ' already exists as a file');
434 434
 			return false;
435 435
 		  }
436
-		  if (!is_writable($v_header['filename'])) {
436
+		  if(!is_writable($v_header['filename'])) {
437 437
 			$this->_error('File ' . $v_header['filename']
438 438
 						  . ' already exists and is write protected');
439 439
 			return false;
440 440
 		  }
441
-		  if (filemtime($v_header['filename']) > $v_header['mtime']) {
441
+		  if(filemtime($v_header['filename']) > $v_header['mtime']) {
442 442
 			// To be completed : An error or silent no replace ?
443 443
 		  }
444 444
 		}
445 445
 
446 446
 		// ----- Check the directory availability and create it if necessary
447
-		elseif (($v_result
447
+		elseif(($v_result
448 448
 				 = $this->_dirCheck(($v_header['typeflag'] == "5"
449
-									?$v_header['filename']
449
+									? $v_header['filename']
450 450
 									:dirname($v_header['filename'])))) != 1) {
451 451
 			$this->_error('Unable to create path for ' . $v_header['filename']);
452 452
 			return false;
453 453
 		}
454 454
 
455
-		if ($v_extract_file) {
456
-		  if ($v_header['typeflag'] == "5") {
457
-			if (!@file_exists($v_header['filename'])) {
458
-				if (!@mkdir($v_header['filename'], PRADO_CHMOD)) {
455
+		if($v_extract_file) {
456
+		  if($v_header['typeflag'] == "5") {
457
+			if(!@file_exists($v_header['filename'])) {
458
+				if(!@mkdir($v_header['filename'], PRADO_CHMOD)) {
459 459
 					$this->_error('Unable to create directory {'
460 460
 								  . $v_header['filename'] . '}');
461 461
 					return false;
@@ -463,17 +463,17 @@  discard block
 block discarded – undo
463 463
 				chmod($v_header['filename'], PRADO_CHMOD);
464 464
 			}
465 465
 		  } else {
466
-			  if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
466
+			  if(($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
467 467
 				  $this->_error('Error while opening {' . $v_header['filename']
468 468
 								. '} in write binary mode');
469 469
 				  return false;
470 470
 			  } else {
471 471
 				  $n = floor($v_header['size'] / 512);
472
-				  for ($i = 0; $i < $n; $i++) {
472
+				  for($i = 0; $i < $n; $i++) {
473 473
 					  $v_content = $this->_readBlock();
474 474
 					  fwrite($v_dest_file, $v_content, 512);
475 475
 				  }
476
-			if (($v_header['size'] % 512) != 0) {
476
+			if(($v_header['size'] % 512) != 0) {
477 477
 			  $v_content = $this->_readBlock();
478 478
 			  fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
479 479
 			}
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 
489 489
 		  // ----- Check the file size
490 490
 		  clearstatcache();
491
-		  if (filesize($v_header['filename']) != $v_header['size']) {
491
+		  if(filesize($v_header['filename']) != $v_header['size']) {
492 492
 			  $this->_error('Extracted file ' . $v_header['filename']
493 493
 							. ' does not have the correct file size \''
494 494
 							. filesize($v_header['filename'])
@@ -511,12 +511,12 @@  discard block
 block discarded – undo
511 511
 		$v_end_of_file = @feof($this->_file);
512 512
 		*/
513 513
 
514
-	  if ($v_listing || $v_extract_file || $v_extraction_stopped) {
514
+	  if($v_listing || $v_extract_file || $v_extraction_stopped) {
515 515
 		// ----- Log extracted files
516
-		if (($v_file_dir = dirname($v_header['filename']))
516
+		if(($v_file_dir = dirname($v_header['filename']))
517 517
 			== $v_header['filename'])
518 518
 		  $v_file_dir = '';
519
-		if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == ''))
519
+		if((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == ''))
520 520
 		  $v_file_dir = '/';
521 521
 
522 522
 		$p_list_detail[$v_nb++] = $v_header;
@@ -536,17 +536,17 @@  discard block
 block discarded – undo
536 536
 	 */
537 537
 	protected function _dirCheck($p_dir)
538 538
 	{
539
-		if ((@is_dir($p_dir)) || ($p_dir == ''))
539
+		if((@is_dir($p_dir)) || ($p_dir == ''))
540 540
 			return true;
541 541
 
542 542
 		$p_parent_dir = dirname($p_dir);
543 543
 
544
-		if (($p_parent_dir != $p_dir) &&
544
+		if(($p_parent_dir != $p_dir) &&
545 545
 			($p_parent_dir != '') &&
546 546
 			(!$this->_dirCheck($p_parent_dir)))
547 547
 			 return false;
548 548
 
549
-		if (!@mkdir($p_dir, PRADO_CHMOD)) {
549
+		if(!@mkdir($p_dir, PRADO_CHMOD)) {
550 550
 			$this->_error("Unable to create directory '$p_dir'");
551 551
 			return false;
552 552
 		}
@@ -557,14 +557,14 @@  discard block
 block discarded – undo
557 557
 
558 558
 	protected function _translateWinPath($p_path, $p_remove_disk_letter = true)
559 559
 	{
560
-	  if (substr(PHP_OS, 0, 3) == 'WIN') {
560
+	  if(substr(PHP_OS, 0, 3) == 'WIN') {
561 561
 		  // ----- Look for potential disk letter
562
-		  if (($p_remove_disk_letter)
562
+		  if(($p_remove_disk_letter)
563 563
 			  && (($v_position = strpos($p_path, ':')) != false)) {
564 564
 			  $p_path = substr($p_path, $v_position + 1);
565 565
 		  }
566 566
 		  // ----- Change potential windows directory separator
567
-		  if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
567
+		  if((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
568 568
 			  $p_path = strtr($p_path, '\\', '/');
569 569
 		  }
570 570
 	  }
Please login to merge, or discard this patch.
framework/Util/TBehavior.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	{
46 46
 		$this->_owner = $owner;
47 47
 		foreach($this->events() as $event => $handler)
48
-			$owner->attachEventHandler($event, [$this,$handler]);
48
+			$owner->attachEventHandler($event, [$this, $handler]);
49 49
 	}
50 50
 
51 51
 	/**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	public function detach($owner)
59 59
 	{
60 60
 		foreach($this->events() as $event => $handler)
61
-			$owner->detachEventHandler($event, [$this,$handler]);
61
+			$owner->detachEventHandler($event, [$this, $handler]);
62 62
 		$this->_owner = null;
63 63
 	}
64 64
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,8 +44,9 @@  discard block
 block discarded – undo
44 44
 	public function attach($owner)
45 45
 	{
46 46
 		$this->_owner = $owner;
47
-		foreach($this->events() as $event => $handler)
48
-			$owner->attachEventHandler($event, [$this,$handler]);
47
+		foreach($this->events() as $event => $handler) {
48
+					$owner->attachEventHandler($event, [$this,$handler]);
49
+		}
49 50
 	}
50 51
 
51 52
 	/**
@@ -57,8 +58,9 @@  discard block
 block discarded – undo
57 58
 	 */
58 59
 	public function detach($owner)
59 60
 	{
60
-		foreach($this->events() as $event => $handler)
61
-			$owner->detachEventHandler($event, [$this,$handler]);
61
+		foreach($this->events() as $event => $handler) {
62
+					$owner->detachEventHandler($event, [$this,$handler]);
63
+		}
62 64
 		$this->_owner = null;
63 65
 	}
64 66
 
Please login to merge, or discard this patch.
framework/Util/TCallChain.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function addCall($method, $args)
52 52
 	{
53
-		$this->add([$method,$args]);
53
+		$this->add([$method, $args]);
54 54
 	}
55 55
 
56 56
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	{
97 97
 		$args = func_get_args();
98 98
 		if($this->getCount() === 0)
99
-			return isset($args[0])?$args[0]:null;
99
+			return isset($args[0]) ? $args[0] : null;
100 100
 
101 101
 		if(!$this->_iterator)
102 102
 		{
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	public function __dycall($method, $args)
145 145
 	{
146 146
 		if($this->_method == $method)
147
-			return call_user_func_array([$this,'call'], $args);
147
+			return call_user_func_array([$this, 'call'], $args);
148 148
 		return null;
149 149
 	}
150 150
 }
151 151
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Util/TLogRouter.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 				throw new TConfigurationException('logrouter_configfile_invalid', $this->_configFile);
85 85
 		}
86 86
 		$this->loadConfig($config);
87
-		$this->getApplication()->attachEventHandler('OnEndRequest', [$this,'collectLogs']);
87
+		$this->getApplication()->attachEventHandler('OnEndRequest', [$this, 'collectLogs']);
88 88
 	}
89 89
 
90 90
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			{
101 101
 				foreach($config['routes'] as $route)
102 102
 				{
103
-					$properties = isset($route['properties'])?$route['properties']:[];
103
+					$properties = isset($route['properties']) ? $route['properties'] : [];
104 104
 					if(!isset($route['class']))
105 105
 						throw new TConfigurationException('logrouter_routeclass_required');
106 106
 					$route = Prado::createComponent($route['class']);
Please login to merge, or discard this patch.
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -72,15 +72,13 @@  discard block
 block discarded – undo
72 72
 				{
73 73
 					$phpConfig = include $this->_configFile;
74 74
 					$this->loadConfig($phpConfig);
75
-				}
76
-				else
75
+				} else
77 76
 				{
78 77
 					$dom = new TXmlDocument;
79 78
 					$dom->loadFromFile($this->_configFile);
80 79
 					$this->loadConfig($dom);
81 80
 				}
82
-			}
83
-			else
81
+			} else
84 82
 				throw new TConfigurationException('logrouter_configfile_invalid', $this->_configFile);
85 83
 		}
86 84
 		$this->loadConfig($config);
@@ -106,14 +104,14 @@  discard block
 block discarded – undo
106 104
 					$route = Prado::createComponent($route['class']);
107 105
 					if(!($route instanceof TLogRoute))
108 106
 						throw new TConfigurationException('logrouter_routetype_invalid');
109
-					foreach($properties as $name => $value)
110
-						$route->setSubproperty($name, $value);
107
+					foreach($properties as $name => $value) {
108
+											$route->setSubproperty($name, $value);
109
+					}
111 110
 					$this->_routes[] = $route;
112 111
 					$route->init($route);
113 112
 				}
114 113
 			}
115
-		}
116
-		else
114
+		} else
117 115
 		{
118 116
 			foreach($config->getElementsByTagName('route') as $routeConfig)
119 117
 			{
@@ -123,8 +121,9 @@  discard block
 block discarded – undo
123 121
 				$route = Prado::createComponent($class);
124 122
 				if(!($route instanceof TLogRoute))
125 123
 					throw new TConfigurationException('logrouter_routetype_invalid');
126
-				foreach($properties as $name => $value)
127
-					$route->setSubproperty($name, $value);
124
+				foreach($properties as $name => $value) {
125
+									$route->setSubproperty($name, $value);
126
+				}
128 127
 				$this->_routes[] = $route;
129 128
 				$route->init($routeConfig);
130 129
 			}
@@ -172,7 +171,8 @@  discard block
 block discarded – undo
172 171
 	public function collectLogs($param)
173 172
 	{
174 173
 		$logger = Prado::getLogger();
175
-		foreach($this->_routes as $route)
176
-			$route->collectLogs($logger);
174
+		foreach($this->_routes as $route) {
175
+					$route->collectLogs($logger);
176
+		}
177 177
 	}
178 178
 }
179 179
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Util/TDataFieldAccessor.php 2 patches
Braces   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 					return $data[$field];
64 64
 
65 65
 				$tmp = $data;
66
-				foreach (explode(".", $field) as $f)
67
-					$tmp = $tmp[$f];
66
+				foreach (explode(".", $field) as $f) {
67
+									$tmp = $tmp[$f];
68
+				}
68 69
 				return $tmp;
69
-			}
70
-			elseif(is_object($data))
70
+			} elseif(is_object($data))
71 71
 			{
72 72
 				if(strpos($field, '.') === false)  // simple field
73 73
 				{
@@ -75,17 +75,16 @@  discard block
 block discarded – undo
75 75
 						return call_user_func([$data,'get' . $field]);
76 76
 					else
77 77
 						return $data->{$field};
78
-				}
79
-				else // field in the format of xxx.yyy.zzz
78
+				} else // field in the format of xxx.yyy.zzz
80 79
 				{
81 80
 					$object = $data;
82
-					foreach(explode('.', $field) as $f)
83
-						$object = TDataFieldAccessor::getDataFieldValue($object, $f);
81
+					foreach(explode('.', $field) as $f) {
82
+											$object = TDataFieldAccessor::getDataFieldValue($object, $f);
83
+					}
84 84
 					return $object;
85 85
 				}
86 86
 			}
87
-		}
88
-		catch(Exception $e)
87
+		} catch(Exception $e)
89 88
 		{
90 89
 			throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid', $field, $e->getMessage());
91 90
 		}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 					return $data[$field];
64 64
 
65 65
 				$tmp = $data;
66
-				foreach (explode(".", $field) as $f)
66
+				foreach(explode(".", $field) as $f)
67 67
 					$tmp = $tmp[$f];
68 68
 				return $tmp;
69 69
 			}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 				if(strpos($field, '.') === false)  // simple field
73 73
 				{
74 74
 					if(method_exists($data, 'get' . $field))
75
-						return call_user_func([$data,'get' . $field]);
75
+						return call_user_func([$data, 'get' . $field]);
76 76
 					else
77 77
 						return $data->{$field};
78 78
 				}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				}
86 86
 			}
87 87
 		}
88
-		catch(Exception $e)
88
+		catch (Exception $e)
89 89
 		{
90 90
 			throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid', $field, $e->getMessage());
91 91
 		}
Please login to merge, or discard this patch.