Completed
Push — namespace2 ( 791eac...5c23fb )
by Fabio
08:41
created
framework/I18N/core/DateFormat.php 4 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
 	/**
81 81
 	 * The DateTimeFormatInfo, containing culture specific patterns and names.
82
- 	 * @var DateTimeFormatInfo
82
+	 * @var DateTimeFormatInfo
83 83
 	 */
84 84
 	protected $formatInfo;
85 85
 
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 
309 309
 	/**
310 310
 	 * Get the year.
311
- 	 * "yy" will return the last two digits of year.
312
- 	 * "yyyy" will return the full integer year.
311
+	 * "yy" will return the last two digits of year.
312
+	 * "yyyy" will return the full integer year.
313 313
 	 * @param array getdate format.
314 314
 	 * @param string a pattern.
315 315
 	 * @return string year
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 
331 331
 	/**
332 332
 	 * Get the month.
333
- 	 * "M" will return integer 1 through 12
334
- 	 * "MM" will return the narrow month name, e.g. "J"
335
- 	 * "MMM" will return the abrreviated month name, e.g. "Jan"
336
- 	 * "MMMM" will return the month name, e.g. "January"
333
+	 * "M" will return integer 1 through 12
334
+	 * "MM" will return the narrow month name, e.g. "J"
335
+	 * "MMM" will return the abrreviated month name, e.g. "Jan"
336
+	 * "MMMM" will return the month name, e.g. "January"
337 337
 	 * @param array getdate format.
338 338
 	 * @param string a pattern.
339 339
 	 * @return string month name
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
 
362 362
 	/**
363 363
 	 * Get the day of the week.
364
- 	 * "E" will return integer 0 (for Sunday) through 6 (for Saturday).
365
- 	 * "EE" will return the narrow day of the week, e.g. "M"
366
- 	 * "EEE" will return the abrreviated day of the week, e.g. "Mon"
367
- 	 * "EEEE" will return the day of the week, e.g. "Monday"
364
+	 * "E" will return integer 0 (for Sunday) through 6 (for Saturday).
365
+	 * "EE" will return the narrow day of the week, e.g. "M"
366
+	 * "EEE" will return the abrreviated day of the week, e.g. "Mon"
367
+	 * "EEEE" will return the day of the week, e.g. "Monday"
368 368
 	 * @param array getdate format.
369 369
 	 * @param string a pattern.
370 370
 	 * @return string day of the week.
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
 	/**
396 396
 	 * Get the day of the month.
397
- 	 * "d" for non-padding, "dd" will always return 2 characters.
397
+	 * "d" for non-padding, "dd" will always return 2 characters.
398 398
 	 * @param array getdate format.
399 399
 	 * @param string a pattern.
400 400
 	 * @return string day of the month
@@ -581,14 +581,14 @@  discard block
 block discarded – undo
581 581
 	protected function getDayInMonth($date, $pattern='FF')
582 582
 	{
583 583
 		switch ($pattern) {
584
-		    case 'F':
585
-		      return @date('j', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
586
-		      break;
587
-		    case 'FF':
588
-		      return @date('d', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
589
-		      break;
590
-		    default:
591
-		      throw new Exception('The pattern for day in month is "F" or "FF".');
584
+			case 'F':
585
+			  return @date('j', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
586
+			  break;
587
+			case 'FF':
588
+			  return @date('d', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
589
+			  break;
590
+			default:
591
+			  throw new Exception('The pattern for day in month is "F" or "FF".');
592 592
 		}
593 593
 	}
594 594
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -87,6 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * Initialize a new DateFormat.
88 88
 	 * @param mixed either, null, a CultureInfo instance,
89 89
 	 * a DateTimeFormatInfo instance, or a locale.
90
+	 * @param string $formatInfo
90 91
 	 * @return DateFormat instance
91 92
 	 */
92 93
 	function __construct($formatInfo=null)
@@ -106,6 +107,7 @@  discard block
 block discarded – undo
106 107
 	/**
107 108
 	 * Format a date according to the pattern.
108 109
 	 * @param mixed the time as integer or string in strtotime format.
110
+	 * @param string $time
109 111
 	 * @return string formatted date time.
110 112
 	 */
111 113
 	public function format($time, $pattern='F', $charset='UTF-8')
@@ -179,6 +181,7 @@  discard block
 block discarded – undo
179 181
 	 * DateTimeFormatInfo::formatDateTime
180 182
 	 * See the tutorial documentation for futher details on the patterns.
181 183
 	 * @param mixed a pattern.
184
+	 * @param string $pattern
182 185
 	 * @return string a pattern.
183 186
 	 * @see DateTimeFormatInfo::formatDateTime()
184 187
 	 */
@@ -269,6 +272,7 @@  discard block
 block discarded – undo
269 272
 	 * Any substrings, starting and ending with a single quote (')
270 273
 	 * will be treated as a single token.
271 274
 	 * @param string pattern.
275
+	 * @param string $pattern
272 276
 	 * @return array string tokens in an array.
273 277
 	 */
274 278
 	protected function getTokens($pattern)
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -134,12 +134,10 @@  discard block
 block discarded – undo
134 134
 			{
135 135
 				$sub = preg_replace('/(^\')|(\'$)/','',$pattern);
136 136
 				$tokens[$i] =  str_replace('``````','\'',$sub);
137
-			}
138
-			else if($pattern == '``````')
137
+			} else if($pattern == '``````')
139 138
 			{
140 139
 				$tokens[$i] = '\'';
141
-			}
142
-			else
140
+			} else
143 141
 			{
144 142
 				$function = $this->getFunctionName($pattern);
145 143
 				if($function != null)
@@ -149,8 +147,7 @@  discard block
 block discarded – undo
149 147
 					{
150 148
 						$rs = $this->$fName($date, $pattern);
151 149
 						$tokens[$i] = $rs;
152
-					}
153
-					else
150
+					} else
154 151
 						throw new
155 152
 						Exception('function '.$function.' not found.');
156 153
 				}
@@ -285,8 +282,7 @@  discard block
 block discarded – undo
285 282
 			if($char==null || $pattern{$i} == $char || $text)
286 283
 			{
287 284
 				$token .= $pattern{$i};
288
-			}
289
-			else
285
+			} else
290 286
 			{
291 287
 				$tokens[] = str_replace("","'",$token);
292 288
 				$token = $pattern{$i};
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * A list of tokens and their function call.
52 52
 	 * @var array
53 53
 	 */
54
-	protected $tokens = array(
54
+	protected $tokens=array(
55 55
 			'G'=>'Era',
56 56
 			'y'=>'Year',
57 57
 			'M'=>'Month',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * A list of methods, to be used by the token function calls.
76 76
 	 * @var array
77 77
 	 */
78
-	protected $methods = array();
78
+	protected $methods=array();
79 79
 
80 80
 	/**
81 81
 	 * The DateTimeFormatInfo, containing culture specific patterns and names.
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	function __construct($formatInfo=null)
93 93
 	{
94
-		if($formatInfo === null)
95
-			$this->formatInfo = DateTimeFormatInfo::getInvariantInfo();
94
+		if($formatInfo===null)
95
+			$this->formatInfo=DateTimeFormatInfo::getInvariantInfo();
96 96
 		else if($formatInfo instanceof CultureInfo)
97
-			$this->formatInfo = $formatInfo->DateTimeFormat;
97
+			$this->formatInfo=$formatInfo->DateTimeFormat;
98 98
 		else if($formatInfo instanceof DateTimeFormatInfo)
99
-			$this->formatInfo = $formatInfo;
99
+			$this->formatInfo=$formatInfo;
100 100
 		else
101
-			$this->formatInfo = DateTimeFormatInfo::getInstance($formatInfo);
101
+			$this->formatInfo=DateTimeFormatInfo::getInstance($formatInfo);
102 102
 
103
-		$this->methods = get_class_methods($this);
103
+		$this->methods=get_class_methods($this);
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,45 +110,45 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function format($time, $pattern='F', $charset='UTF-8')
112 112
 	{
113
-		if (is_numeric($time)) //assumes unix epoch
114
-			$time = floatval($time);
113
+		if(is_numeric($time)) //assumes unix epoch
114
+			$time=floatval($time);
115 115
 		else if(is_string($time))
116
-			$time = @strtotime($time);
116
+			$time=@strtotime($time);
117 117
 
118
-		if($pattern === null)
119
-			$pattern = 'F';
118
+		if($pattern===null)
119
+			$pattern='F';
120 120
 
121
-		$s = Prado::createComponent('System.Util.TDateTimeStamp');
121
+		$s=Prado::createComponent('System.Util.TDateTimeStamp');
122 122
 
123
-		$date = $s->getDate($time);
123
+		$date=$s->getDate($time);
124 124
 
125
-		$pattern = $this->getPattern($pattern);
125
+		$pattern=$this->getPattern($pattern);
126 126
 
127
-		$tokens = $this->getTokens($pattern);
127
+		$tokens=$this->getTokens($pattern);
128 128
 
129
-		for($i = 0, $k = count($tokens); $i<$k; ++$i)
129
+		for($i=0, $k=count($tokens); $i < $k; ++$i)
130 130
 		{
131
-			$pattern = $tokens[$i];
132
-			if($pattern{0} == "'"
133
-				&& $pattern{strlen($pattern)-1} == "'")
131
+			$pattern=$tokens[$i];
132
+			if($pattern{0}=="'"
133
+				&& $pattern{strlen($pattern) - 1}=="'")
134 134
 			{
135
-				$sub = preg_replace('/(^\')|(\'$)/','',$pattern);
136
-				$tokens[$i] =  str_replace('``````','\'',$sub);
135
+				$sub=preg_replace('/(^\')|(\'$)/', '', $pattern);
136
+				$tokens[$i]=str_replace('``````', '\'', $sub);
137 137
 			}
138
-			else if($pattern == '``````')
138
+			else if($pattern=='``````')
139 139
 			{
140
-				$tokens[$i] = '\'';
140
+				$tokens[$i]='\'';
141 141
 			}
142 142
 			else
143 143
 			{
144
-				$function = $this->getFunctionName($pattern);
145
-				if($function != null)
144
+				$function=$this->getFunctionName($pattern);
145
+				if($function!=null)
146 146
 				{
147
-					$fName = 'get'.$function;
147
+					$fName='get'.$function;
148 148
 					if(in_array($fName, $this->methods))
149 149
 					{
150
-						$rs = $this->$fName($date, $pattern);
151
-						$tokens[$i] = $rs;
150
+						$rs=$this->$fName($date, $pattern);
151
+						$tokens[$i]=$rs;
152 152
 					}
153 153
 					else
154 154
 						throw new
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			}			
158 158
 		}
159 159
 
160
-		return I18N_toEncoding(implode('',$tokens), $charset);
160
+		return I18N_toEncoding(implode('', $tokens), $charset);
161 161
 	}
162 162
 
163 163
 	/**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function getPattern($pattern)
186 186
 	{
187
-		if(is_array($pattern) && count($pattern) == 2)
187
+		if(is_array($pattern) && count($pattern)==2)
188 188
 		{
189 189
 			return $this->formatInfo->formatDateTime(
190 190
 							$this->getPattern($pattern[0]),
@@ -273,36 +273,36 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	protected function getTokens($pattern)
275 275
 	{
276
-		$char = null;
277
-		$tokens = array();
278
-		$token = null;
276
+		$char=null;
277
+		$tokens=array();
278
+		$token=null;
279 279
 
280
-		$text = false;
281
-		$pattern = preg_replace("/''/", '``````', $pattern);
280
+		$text=false;
281
+		$pattern=preg_replace("/''/", '``````', $pattern);
282 282
 
283
-		for($i = 0; $i < strlen($pattern); $i++)
283
+		for($i=0; $i < strlen($pattern); $i++)
284 284
 		{
285
-			if($char==null || $pattern{$i} == $char || $text)
285
+			if($char==null || $pattern{$i}==$char || $text)
286 286
 			{
287
-				$token .= $pattern{$i};
287
+				$token.=$pattern{$i};
288 288
 			}
289 289
 			else
290 290
 			{
291
-				$tokens[] = str_replace("","'",$token);
292
-				$token = $pattern{$i};
291
+				$tokens[]=str_replace("", "'", $token);
292
+				$token=$pattern{$i};
293 293
 			}
294 294
 
295
-			if($pattern{$i} == "'" && $text == false)
296
-				$text = true;
297
-			else if($text && $pattern{$i} == "'" && $char == "'")
298
-				$text = true;
299
-			else if($text && $char != "'" && $pattern{$i} == "'")
300
-				$text = false;
295
+			if($pattern{$i}=="'" && $text==false)
296
+				$text=true;
297
+			else if($text && $pattern{$i}=="'" && $char=="'")
298
+				$text=true;
299
+			else if($text && $char!="'" && $pattern{$i}=="'")
300
+				$text=false;
301 301
 
302
-			$char = $pattern{$i};
302
+			$char=$pattern{$i};
303 303
 
304 304
 		}
305
-		$tokens[] = $token;
305
+		$tokens[]=$token;
306 306
 		return $tokens;
307 307
 	}
308 308
 
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	protected function getYear($date, $pattern='yyyy')
318 318
 	{
319
-		$year = $date['year'];
319
+		$year=$date['year'];
320 320
 		switch($pattern)
321 321
 		{
322 322
 			case 'yy':
323
-				return substr($year,2);
323
+				return substr($year, 2);
324 324
 			case 'yyyy':
325 325
 				return $year;
326 326
 			default:
@@ -340,19 +340,19 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	protected function getMonth($date, $pattern='M')
342 342
 	{
343
-		$month = $date['mon'];
343
+		$month=$date['mon'];
344 344
 
345 345
 		switch($pattern)
346 346
 		{
347 347
 			case 'M':
348 348
 				return $month;
349 349
 			case 'MM':
350
-				return str_pad($month, 2,'0',STR_PAD_LEFT);
350
+				return str_pad($month, 2, '0', STR_PAD_LEFT);
351 351
 			case 'MMM':
352
-				return $this->formatInfo->AbbreviatedMonthNames[$month-1];
352
+				return $this->formatInfo->AbbreviatedMonthNames[$month - 1];
353 353
 				break;
354 354
 			case 'MMMM':
355
-				return $this->formatInfo->MonthNames[$month-1];
355
+				return $this->formatInfo->MonthNames[$month - 1];
356 356
 			default:
357 357
 				throw new Exception('The pattern for month '.
358 358
 						'is "M", "MM", "MMM", or "MMMM".');
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	protected function getDayInWeek($date, $pattern='EEEE')
373 373
 	{
374
-		$day = $date['wday'];
374
+		$day=$date['wday'];
375 375
 
376 376
 		switch($pattern)
377 377
 		{
@@ -401,14 +401,14 @@  discard block
 block discarded – undo
401 401
 	 */
402 402
 	protected function getDay($date, $pattern='d')
403 403
 	{
404
-		$day = $date['mday'];
404
+		$day=$date['mday'];
405 405
 
406 406
 		switch($pattern)
407 407
 		{
408 408
 			case 'd':
409 409
 				return $day;
410 410
 			case 'dd':
411
-				return str_pad($day, 2,'0',STR_PAD_LEFT);
411
+				return str_pad($day, 2, '0', STR_PAD_LEFT);
412 412
 			default:
413 413
 				throw new Exception('The pattern for day of '.
414 414
 						'the month is "d" or "dd".');
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	protected function getEra($date, $pattern='G')
427 427
 	{
428 428
 
429
-		if($pattern != 'G')
429
+		if($pattern!='G')
430 430
 			throw new Exception('The pattern for era is "G".');
431 431
 
432
-		$year = $date['year'];
432
+		$year=$date['year'];
433 433
 		if($year > 0)
434 434
 			return $this->formatInfo->getEra(1);
435 435
 		else
@@ -445,14 +445,14 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	protected function getHour24($date, $pattern='H')
447 447
 	{
448
-		$hour = $date['hours'];
448
+		$hour=$date['hours'];
449 449
 
450 450
 		switch($pattern)
451 451
 		{
452 452
 			case 'H':
453 453
 				return $hour;
454 454
 			case 'HH':
455
-				return str_pad($hour, 2,'0',STR_PAD_LEFT);
455
+				return str_pad($hour, 2, '0', STR_PAD_LEFT);
456 456
 			default:
457 457
 				throw new Exception('The pattern for 24 hour '.
458 458
 						'format is "H" or "HH".');
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 	 */
468 468
 	protected function getAMPM($date, $pattern='a')
469 469
 	{
470
-		if($pattern != 'a')
470
+		if($pattern!='a')
471 471
 			throw new Exception('The pattern for AM/PM marker is "a".');
472 472
 
473
-		$hour = $date['hours'];
474
-		$ampm = (int)($hour/12);
473
+		$hour=$date['hours'];
474
+		$ampm=(int) ($hour / 12);
475 475
 		return $this->formatInfo->AMPMMarkers[$ampm];
476 476
 	}
477 477
 
@@ -484,15 +484,15 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	protected function getHour12($date, $pattern='h')
486 486
 	{
487
-		$hour = $date['hours'];
488
-		$hour = ($hour==12|$hour==0)?12:($hour)%12;
487
+		$hour=$date['hours'];
488
+		$hour=($hour==12 | $hour==0) ? 12 : ($hour) % 12;
489 489
 
490 490
 		switch($pattern)
491 491
 		{
492 492
 			case 'h':
493 493
 				return $hour;
494 494
 			case 'hh':
495
-				return str_pad($hour, 2,'0',STR_PAD_LEFT);
495
+				return str_pad($hour, 2, '0', STR_PAD_LEFT);
496 496
 			default:
497 497
 				throw new Exception('The pattern for 24 hour '.
498 498
 						'format is "H" or "HH".');
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
 	 */
509 509
 	protected function getMinutes($date, $pattern='m')
510 510
 	{
511
-		$minutes = $date['minutes'];
511
+		$minutes=$date['minutes'];
512 512
 
513 513
 		switch($pattern)
514 514
 		{
515 515
 			case 'm':
516 516
 				return $minutes;
517 517
 			case 'mm':
518
-				return str_pad($minutes, 2,'0',STR_PAD_LEFT);
518
+				return str_pad($minutes, 2, '0', STR_PAD_LEFT);
519 519
 			default:
520 520
 			throw new Exception('The pattern for minutes is "m" or "mm".');
521 521
 		}
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	protected function getSeconds($date, $pattern='s')
532 532
 	{
533
-		$seconds = $date['seconds'];
533
+		$seconds=$date['seconds'];
534 534
 
535 535
 		switch($pattern)
536 536
 		{
537 537
 			case 's':
538 538
 				return $seconds;
539 539
 			case 'ss':
540
-				return str_pad($seconds, 2,'0',STR_PAD_LEFT);
540
+				return str_pad($seconds, 2, '0', STR_PAD_LEFT);
541 541
 			default:
542 542
 			throw new Exception('The pattern for seconds is "s" or "ss".');
543 543
 		}
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 */
553 553
 	protected function getTimeZone($date, $pattern='z')
554 554
 	{
555
-		if($pattern != 'z')
555
+		if($pattern!='z')
556 556
 			throw new Exception('The pattern for time zone is "z".');
557 557
 
558 558
 		return @date('T', @mktime($date['hours'], $date['minutes'], $date['seconds'], $date['mon'], $date['mday'], $date['year']));
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	protected function getDayInYear($date, $pattern='D')
568 568
 	{
569
-		if($pattern != 'D')
569
+		if($pattern!='D')
570 570
 			throw new Exception('The pattern for day in year is "D".');
571 571
 
572 572
 		return $date['yday'];
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	 */
581 581
 	protected function getDayInMonth($date, $pattern='FF')
582 582
 	{
583
-		switch ($pattern) {
583
+		switch($pattern) {
584 584
 		    case 'F':
585 585
 		      return @date('j', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
586 586
 		      break;
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 */
601 601
 	protected function getWeekInYear($date, $pattern='w')
602 602
 	{
603
-		if($pattern != 'w')
603
+		if($pattern!='w')
604 604
 			throw new Exception('The pattern for week in year is "w".');
605 605
 
606 606
 		return @date('W', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	protected function getWeekInMonth($date, $pattern='W')
615 615
 	{
616
-		if($pattern != 'W')
616
+		if($pattern!='W')
617 617
 			throw new Exception('The pattern for week in month is "W".');
618 618
 
619 619
 		return @date('W', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year'])) - date('W', mktime(0, 0, 0, $date['mon'], 1, $date['year']));
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 	 */
628 628
 	protected function getHourInDay($date, $pattern='k')
629 629
 	{
630
-		if($pattern != 'k')
630
+		if($pattern!='k')
631 631
 			throw new Exception('The pattern for hour in day is "k".');
632 632
 
633
-		return $date['hours']+1;
633
+		return $date['hours'] + 1;
634 634
 	}
635 635
 
636 636
 	/**
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 	 */
642 642
 	protected function getHourInAMPM($date, $pattern='K')
643 643
 	{
644
-		if($pattern != 'K')
644
+		if($pattern!='K')
645 645
 			throw new Exception('The pattern for hour in AM/PM is "K".');
646 646
 
647
-		return ($date['hours']+1)%12;
647
+		return ($date['hours'] + 1) % 12;
648 648
 	}
649 649
 
650 650
 }
Please login to merge, or discard this patch.
framework/I18N/core/NumberFormat.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	/**
78 78
 	 * The DateTimeFormatInfo, containing culture specific patterns and names.
79
- 	 * @var DateTimeFormatInfo
79
+	 * @var DateTimeFormatInfo
80 80
 	 */
81 81
 	protected $formatInfo;
82 82
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	function format($number, $pattern='d', $currency='USD', $charset='UTF-8')
117 117
 	{
118 118
 		$oldLocale=setLocale(LC_NUMERIC, '0');
119
-	    setlocale(LC_NUMERIC, 'C');
119
+		setlocale(LC_NUMERIC, 'C');
120 120
 
121 121
 		$this->setPattern($pattern);
122 122
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,6 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * a CultureInfo or NumberFormatInfo instance will instantiated a instance
87 87
 	 * for that particular culture.
88 88
 	 * @param mixed either null, a CultureInfo, a NumberFormatInfo, or string
89
+	 * @param string $formatInfo
89 90
 	 * @return NumberFormat
90 91
 	 */
91 92
 	function __construct($formatInfo=null)
@@ -111,6 +112,7 @@  discard block
 block discarded – undo
111 112
 	 * 3 decimal places.
112 113
 	 * @param string 3-letter ISO 4217 code. For example, the code
113 114
 	 * "USD" represents the US Dollar and "EUR" represents the Euro currency.
115
+	 * @param string $number
114 116
 	 * @return string formatted number string
115 117
 	 */
116 118
 	function format($number, $pattern='d', $currency='USD', $charset='UTF-8')
@@ -232,7 +234,7 @@  discard block
 block discarded – undo
232 234
 
233 235
 	/**
234 236
 	 * Format the decimal places.
235
-	 * @param string the decimal number in string form.
237
+	 * @param string string decimal number in string form.
236 238
 	 * @return string formatted decimal places.
237 239
 	 */
238 240
 	protected function formatDecimal($string)
@@ -280,6 +282,7 @@  discard block
 block discarded – undo
280 282
 	 * Set the pattern to format against. The default patterns
281 283
 	 * are retrieved from the NumberFormatInfo instance.
282 284
 	 * @param string the requested patterns.
285
+	 * @param string $pattern
283 286
 	 * @return string a number format pattern.
284 287
 	 */
285 288
 	protected function setPattern($pattern)
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -203,16 +203,14 @@  discard block
 block discarded – undo
203 203
 						$integer = $groupSeparator . $integer;
204 204
 						$count++;
205 205
 					}
206
-				}
207
-				else if($multiGroup && $count >= 1)
206
+				} else if($multiGroup && $count >= 1)
208 207
 				{
209 208
 					if($i != 0 && ($i-$groupSize[0])%$groupSize[1] == 0)
210 209
 					{
211 210
 						$integer = $groupSeparator . $integer;
212 211
 						$count++;
213 212
 					}
214
-				}
215
-				else
213
+				} else
216 214
 				{
217 215
 					if($i != 0 && $i%$groupSize[0] == 0)
218 216
 					{
@@ -223,8 +221,7 @@  discard block
 block discarded – undo
223 221
 
224 222
 				$integer = $char . $integer;
225 223
 			}
226
-		}
227
-		else
224
+		} else
228 225
 			$integer = $string;
229 226
 
230 227
 		return $integer;
@@ -250,27 +247,23 @@  discard block
 block discarded – undo
250 247
 			if($decimalDigits == -1)
251 248
 			{
252 249
 				$decimal = substr($string, $dp+1);
253
-			}
254
-			else if(is_int($decimalDigits))
250
+			} else if(is_int($decimalDigits))
255 251
 			{
256 252
 				$float = round((float)$string, $decimalDigits);
257 253
 				if(strpos((string)$float, '.') === false)
258 254
 				{
259 255
 					$decimal = str_pad($decimal,$decimalDigits,'0');
260
-				}
261
-				else
256
+				} else
262 257
 				{
263 258
 					$decimal = substr($float, strpos($float,'.')+1);
264 259
 					if(strlen($decimal)<$decimalDigits)
265 260
 						$decimal = str_pad($decimal,$decimalDigits,'0');
266 261
 				}
267
-			}
268
-			else
262
+			} else
269 263
 				return $decimal;
270 264
 
271 265
 			return $decimalSeparator.$decimal;
272
-		}
273
-		else if ($decimalDigits > 0)
266
+		} else if ($decimalDigits > 0)
274 267
 			return $decimalSeparator.str_pad($decimal,$decimalDigits,'0');
275 268
 
276 269
 		return $decimal;
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	function __construct($formatInfo=null)
92 92
 	{
93
-		if($formatInfo === null)
94
-			$this->formatInfo = NumberFormatInfo::getInvariantInfo();
93
+		if($formatInfo===null)
94
+			$this->formatInfo=NumberFormatInfo::getInvariantInfo();
95 95
 		else if($formatInfo instanceof CultureInfo)
96
-			$this->formatInfo = $formatInfo->NumberFormat;
96
+			$this->formatInfo=$formatInfo->NumberFormat;
97 97
 		else if($formatInfo instanceof NumberFormatInfo)
98
-			$this->formatInfo = $formatInfo;
98
+			$this->formatInfo=$formatInfo;
99 99
 		else
100
-			$this->formatInfo =
100
+			$this->formatInfo=
101 101
 				NumberFormatInfo::getInstance($formatInfo);
102 102
 	}
103 103
 
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
 
121 121
 		$this->setPattern($pattern);
122 122
 
123
-		if(strtolower($pattern) == 'p')
124
-			$number = $number * 100;
123
+		if(strtolower($pattern)=='p')
124
+			$number=$number * 100;
125 125
 
126
-		$string = (string)$number;
126
+		$string=(string) $number;
127 127
 
128
-		$decimal = $this->formatDecimal($string);
129
-		$integer = $this->formatInteger(abs($number));
128
+		$decimal=$this->formatDecimal($string);
129
+		$integer=$this->formatInteger(abs($number));
130 130
 
131
-		if(strlen($decimal)>0)
132
-			$result = $integer.$decimal;
131
+		if(strlen($decimal) > 0)
132
+			$result=$integer.$decimal;
133 133
 		else
134
-			$result = $integer;
134
+			$result=$integer;
135 135
 
136 136
 		//get the suffix
137 137
 		if($number >= 0)
138
-			$suffix = $this->formatInfo->PositivePattern;
138
+			$suffix=$this->formatInfo->PositivePattern;
139 139
 		else if($number < 0)
140
-			$suffix = $this->formatInfo->NegativePattern;
140
+			$suffix=$this->formatInfo->NegativePattern;
141 141
 		else
142
-			$suffix = array("","");
142
+			$suffix=array("", "");
143 143
 
144 144
 		//append and prepend suffix
145
-		$result = $suffix[0].$result.$suffix[1];
145
+		$result=$suffix[0].$result.$suffix[1];
146 146
 
147 147
 		//replace currency sign
148
-		$symbol = @$this->formatInfo->getCurrencySymbol($currency);
149
-		if($symbol === null) {
150
-			$symbol = $currency;
148
+		$symbol=@$this->formatInfo->getCurrencySymbol($currency);
149
+		if($symbol===null) {
150
+			$symbol=$currency;
151 151
 		}
152 152
 
153
-		$result = str_replace('¤',$symbol, $result);
153
+		$result=str_replace('¤', $symbol, $result);
154 154
 
155 155
 		setlocale(LC_NUMERIC, $oldLocale);
156 156
 
@@ -164,68 +164,68 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	protected function formatInteger($string)
166 166
 	{
167
-		$string = (string)$string;
167
+		$string=(string) $string;
168 168
 
169
-		$decimalDigits = $this->formatInfo->DecimalDigits;
169
+		$decimalDigits=$this->formatInfo->DecimalDigits;
170 170
 		//if not decimal digits, assume 0 decimal points.
171 171
 		if(is_int($decimalDigits) && $decimalDigits > 0)
172
-			$string = (string)round(floatval($string),$decimalDigits);
173
-		$dp = strpos($string, '.');
172
+			$string=(string) round(floatval($string), $decimalDigits);
173
+		$dp=strpos($string, '.');
174 174
 		if(is_int($dp))
175
-			$string = substr($string, 0, $dp);
176
-		$integer = '';
175
+			$string=substr($string, 0, $dp);
176
+		$integer='';
177 177
 
178
-		$digitSize = $this->formatInfo->getDigitSize();
178
+		$digitSize=$this->formatInfo->getDigitSize();
179 179
 
180
-		$string = str_pad($string, $digitSize, '0',STR_PAD_LEFT);
180
+		$string=str_pad($string, $digitSize, '0', STR_PAD_LEFT);
181 181
 
182
-		$len = strlen($string);
182
+		$len=strlen($string);
183 183
 
184
-		$groupSeparator = $this->formatInfo->GroupSeparator;
185
-		$groupSize = $this->formatInfo->GroupSizes;
184
+		$groupSeparator=$this->formatInfo->GroupSeparator;
185
+		$groupSize=$this->formatInfo->GroupSizes;
186 186
 
187 187
 
188
-		$firstGroup = true;
189
-		$multiGroup = is_int($groupSize[1]);
190
-		$count = 0;
188
+		$firstGroup=true;
189
+		$multiGroup=is_int($groupSize[1]);
190
+		$count=0;
191 191
 
192 192
 		if(is_int($groupSize[0]))
193 193
 		{
194 194
 			//now for the integer groupings
195
-			for($i=0; $i<$len; $i++)
195
+			for($i=0; $i < $len; $i++)
196 196
 			{
197
-				$char = $string{$len-$i-1};
197
+				$char=$string{$len - $i - 1};
198 198
 
199
-				if($multiGroup && $count == 0)
199
+				if($multiGroup && $count==0)
200 200
 				{
201
-					if($i != 0 && $i%$groupSize[0] == 0)
201
+					if($i!=0 && $i % $groupSize[0]==0)
202 202
 					{
203
-						$integer = $groupSeparator . $integer;
203
+						$integer=$groupSeparator.$integer;
204 204
 						$count++;
205 205
 					}
206 206
 				}
207 207
 				else if($multiGroup && $count >= 1)
208 208
 				{
209
-					if($i != 0 && ($i-$groupSize[0])%$groupSize[1] == 0)
209
+					if($i!=0 && ($i - $groupSize[0]) % $groupSize[1]==0)
210 210
 					{
211
-						$integer = $groupSeparator . $integer;
211
+						$integer=$groupSeparator.$integer;
212 212
 						$count++;
213 213
 					}
214 214
 				}
215 215
 				else
216 216
 				{
217
-					if($i != 0 && $i%$groupSize[0] == 0)
217
+					if($i!=0 && $i % $groupSize[0]==0)
218 218
 					{
219
-						$integer = $groupSeparator . $integer;
219
+						$integer=$groupSeparator.$integer;
220 220
 						$count++;
221 221
 					}
222 222
 				}
223 223
 
224
-				$integer = $char . $integer;
224
+				$integer=$char.$integer;
225 225
 			}
226 226
 		}
227 227
 		else
228
-			$integer = $string;
228
+			$integer=$string;
229 229
 
230 230
 		return $integer;
231 231
 	}
@@ -237,32 +237,32 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	protected function formatDecimal($string)
239 239
 	{
240
-		$dp = strpos($string, '.');
241
-		$decimal = '';
240
+		$dp=strpos($string, '.');
241
+		$decimal='';
242 242
 
243
-		$decimalDigits = $this->formatInfo->DecimalDigits;
244
-		$decimalSeparator = $this->formatInfo->DecimalSeparator;
243
+		$decimalDigits=$this->formatInfo->DecimalDigits;
244
+		$decimalSeparator=$this->formatInfo->DecimalSeparator;
245 245
 
246 246
 		//do the correct rounding here
247 247
 		//$string = round(floatval($string), $decimalDigits);
248 248
 		if(is_int($dp))
249 249
 		{
250
-			if($decimalDigits == -1)
250
+			if($decimalDigits==-1)
251 251
 			{
252
-				$decimal = substr($string, $dp+1);
252
+				$decimal=substr($string, $dp + 1);
253 253
 			}
254 254
 			else if(is_int($decimalDigits))
255 255
 			{
256
-				$float = round((float)$string, $decimalDigits);
257
-				if(strpos((string)$float, '.') === false)
256
+				$float=round((float) $string, $decimalDigits);
257
+				if(strpos((string) $float, '.')===false)
258 258
 				{
259
-					$decimal = str_pad($decimal,$decimalDigits,'0');
259
+					$decimal=str_pad($decimal, $decimalDigits, '0');
260 260
 				}
261 261
 				else
262 262
 				{
263
-					$decimal = substr($float, strpos($float,'.')+1);
264
-					if(strlen($decimal)<$decimalDigits)
265
-						$decimal = str_pad($decimal,$decimalDigits,'0');
263
+					$decimal=substr($float, strpos($float, '.') + 1);
264
+					if(strlen($decimal) < $decimalDigits)
265
+						$decimal=str_pad($decimal, $decimalDigits, '0');
266 266
 				}
267 267
 			}
268 268
 			else
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 
271 271
 			return $decimalSeparator.$decimal;
272 272
 		}
273
-		else if ($decimalDigits > 0)
274
-			return $decimalSeparator.str_pad($decimal,$decimalDigits,'0');
273
+		else if($decimalDigits > 0)
274
+			return $decimalSeparator.str_pad($decimal, $decimalDigits, '0');
275 275
 
276 276
 		return $decimal;
277 277
 	}
Please login to merge, or discard this patch.
framework/I18N/core/HTTPNegotiator.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		$this->languages = array();
59 59
 
60 60
 		if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
61
-            return $this->languages;
61
+			return $this->languages;
62 62
 
63 63
 		//$basedir = CultureInfo::dataDir();
64 64
 		//$ext = CultureInfo::fileExt();
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
 
67 67
 		foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang)
68 68
 		{
69
-            // Cut off any q-value that might come after a semi-colon
70
-            if ($pos = strpos($lang, ';'))
71
-                $lang = trim(substr($lang, 0, $pos));
69
+			// Cut off any q-value that might come after a semi-colon
70
+			if ($pos = strpos($lang, ';'))
71
+				$lang = trim(substr($lang, 0, $pos));
72 72
 
73 73
 			if (strstr($lang, '-'))
74 74
 			{
75 75
 				$codes = explode('-',$lang);
76 76
 				if($codes[0] == 'i')
77 77
 				{
78
-                    // Language not listed in ISO 639 that are not variants
79
-                    // of any listed language, which can be registerd with the
80
-                    // i-prefix, such as i-cherokee
78
+					// Language not listed in ISO 639 that are not variants
79
+					// of any listed language, which can be registerd with the
80
+					// i-prefix, such as i-cherokee
81 81
 					if(count($codes)>1)
82 82
 						$lang = $codes[1];
83 83
 				}
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 							$lang .= '_'.strtoupper($codes[$i]);
92 92
 					}
93 93
 				}
94
-            }
94
+			}
95 95
 
96 96
 
97 97
 
98 98
 			if($info->validCulture($lang))
99 99
 				$this->languages[] = $lang;
100
-        }
100
+		}
101 101
 
102 102
 		return $this->languages;
103 103
 	}
@@ -108,20 +108,20 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	function getCharsets()
110 110
 	{
111
-        if($this->charsets !== null) {
111
+		if($this->charsets !== null) {
112 112
 			return $this->charsets;
113 113
 		}
114 114
 
115 115
 		$this->charsets = array();
116 116
 
117 117
 		if (!isset($_SERVER['HTTP_ACCEPT_CHARSET']))
118
-            return $this->charsets;
118
+			return $this->charsets;
119 119
 
120 120
 		foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset)
121 121
 		{
122
-            if (!empty($charset))
123
-                $this->charsets[] = preg_replace('/;.*/', '', $charset);
124
-        }
122
+			if (!empty($charset))
123
+				$this->charsets[] = preg_replace('/;.*/', '', $charset);
124
+		}
125 125
 
126 126
 		return $this->charsets;
127 127
 	}
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -51,44 +51,44 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	function getLanguages()
53 53
 	{
54
-		if($this->languages !== null) {
54
+		if($this->languages!==null) {
55 55
 			return $this->languages;
56 56
 		}
57 57
 
58
-		$this->languages = array();
58
+		$this->languages=array();
59 59
 
60
-		if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
60
+		if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
61 61
             return $this->languages;
62 62
 
63 63
 		//$basedir = CultureInfo::dataDir();
64 64
 		//$ext = CultureInfo::fileExt();
65
-		$info = new CultureInfo();
65
+		$info=new CultureInfo();
66 66
 
67 67
 		foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang)
68 68
 		{
69 69
             // Cut off any q-value that might come after a semi-colon
70
-            if ($pos = strpos($lang, ';'))
71
-                $lang = trim(substr($lang, 0, $pos));
70
+            if($pos=strpos($lang, ';'))
71
+                $lang=trim(substr($lang, 0, $pos));
72 72
 
73
-			if (strstr($lang, '-'))
73
+			if(strstr($lang, '-'))
74 74
 			{
75
-				$codes = explode('-',$lang);
76
-				if($codes[0] == 'i')
75
+				$codes=explode('-', $lang);
76
+				if($codes[0]=='i')
77 77
 				{
78 78
                     // Language not listed in ISO 639 that are not variants
79 79
                     // of any listed language, which can be registerd with the
80 80
                     // i-prefix, such as i-cherokee
81
-					if(count($codes)>1)
82
-						$lang = $codes[1];
81
+					if(count($codes) > 1)
82
+						$lang=$codes[1];
83 83
 				}
84 84
 				else
85 85
 				{
86
-					for($i = 0, $k = count($codes); $i<$k; ++$i)
86
+					for($i=0, $k=count($codes); $i < $k; ++$i)
87 87
 					{
88
-						if($i == 0)
89
-							$lang = strtolower($codes[0]);
88
+						if($i==0)
89
+							$lang=strtolower($codes[0]);
90 90
 						else
91
-							$lang .= '_'.strtoupper($codes[$i]);
91
+							$lang.='_'.strtoupper($codes[$i]);
92 92
 					}
93 93
 				}
94 94
             }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 
98 98
 			if($info->validCulture($lang))
99
-				$this->languages[] = $lang;
99
+				$this->languages[]=$lang;
100 100
         }
101 101
 
102 102
 		return $this->languages;
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	function getCharsets()
110 110
 	{
111
-        if($this->charsets !== null) {
111
+        if($this->charsets!==null) {
112 112
 			return $this->charsets;
113 113
 		}
114 114
 
115
-		$this->charsets = array();
115
+		$this->charsets=array();
116 116
 
117
-		if (!isset($_SERVER['HTTP_ACCEPT_CHARSET']))
117
+		if(!isset($_SERVER['HTTP_ACCEPT_CHARSET']))
118 118
             return $this->charsets;
119 119
 
120
-		foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset)
120
+		foreach(explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset)
121 121
 		{
122
-            if (!empty($charset))
123
-                $this->charsets[] = preg_replace('/;.*/', '', $charset);
122
+            if(!empty($charset))
123
+                $this->charsets[]=preg_replace('/;.*/', '', $charset);
124 124
         }
125 125
 
126 126
 		return $this->charsets;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@
 block discarded – undo
70 70
 				{
71 71
 					$domain=substr($value,$pos+1);
72 72
 					return $domain===''?false:checkdnsrr($domain,'MX');
73
-				}
74
-				else
73
+				} else
75 74
 					return false;
76 75
 			}
77 76
 		}
Please login to merge, or discard this patch.
framework/I18N/core/MessageSource_MySQL.php 4 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -92,43 +92,43 @@
 block discarded – undo
92 92
 		*/
93 93
 		$dsninfo = $this->dns;
94 94
 
95
-     	if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix')
96
-            $dbhost = ':' . $dsninfo['socket'];
97
-        else
98
-        {
95
+	 	if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix')
96
+			$dbhost = ':' . $dsninfo['socket'];
97
+		else
98
+		{
99 99
 			$dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost';
100
-            if (!empty($dsninfo['port']))
101
-                $dbhost .= ':' . $dsninfo['port'];
102
-        }
103
-        $user = $dsninfo['username'];
104
-        $pw = $dsninfo['password'];
105
-
106
-        $connect_function = 'mysql_connect';
107
-
108
-        if ($dbhost && $user && $pw)
109
-            $conn = @$connect_function($dbhost, $user, $pw);
110
-        elseif ($dbhost && $user)
111
-            $conn = @$connect_function($dbhost, $user);
112
-        elseif ($dbhost)
113
-            $conn = @$connect_function($dbhost);
114
-        else
115
-            $conn = false;
116
-
117
-        if (empty($conn))
118
-        {
119
-        	throw new Exception('Error in connecting to '.$dsninfo);
120
-        }
121
-
122
-        if ($dsninfo['database'])
123
-        {
124
-        	if (!@mysql_select_db($dsninfo['database'], $conn))
125
-        		throw new Exception('Error in connecting database, dns:'.
126
-        							$dsninfo);
127
-        }
128
-        else
129
-        	throw new Exception('Please provide a database for message'.
130
-        						' translation.');
131
-       return $conn;
100
+			if (!empty($dsninfo['port']))
101
+				$dbhost .= ':' . $dsninfo['port'];
102
+		}
103
+		$user = $dsninfo['username'];
104
+		$pw = $dsninfo['password'];
105
+
106
+		$connect_function = 'mysql_connect';
107
+
108
+		if ($dbhost && $user && $pw)
109
+			$conn = @$connect_function($dbhost, $user, $pw);
110
+		elseif ($dbhost && $user)
111
+			$conn = @$connect_function($dbhost, $user);
112
+		elseif ($dbhost)
113
+			$conn = @$connect_function($dbhost);
114
+		else
115
+			$conn = false;
116
+
117
+		if (empty($conn))
118
+		{
119
+			throw new Exception('Error in connecting to '.$dsninfo);
120
+		}
121
+
122
+		if ($dsninfo['database'])
123
+		{
124
+			if (!@mysql_select_db($dsninfo['database'], $conn))
125
+				throw new Exception('Error in connecting database, dns:'.
126
+									$dsninfo);
127
+		}
128
+		else
129
+			throw new Exception('Please provide a database for message'.
130
+								' translation.');
131
+	   return $conn;
132 132
 	}
133 133
 
134 134
 	/**
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -271,7 +271,9 @@
 block discarded – undo
271 271
 
272 272
 	/**
273 273
 	 * Update the catalogue last modified time.
274
-	 * @return boolean true if updated, false otherwise.
274
+	 * @param integer $cat_id
275
+	 * @param string $variant
276
+	 * @return resource true if updated, false otherwise.
275 277
 	 */
276 278
 	private function updateCatalogueTime($cat_id, $variant)
277 279
 	{
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,8 +124,7 @@
 block discarded – undo
124 124
         	if (!@mysql_select_db($dsninfo['database'], $conn))
125 125
         		throw new Exception('Error in connecting database, dns:'.
126 126
         							$dsninfo);
127
-        }
128
-        else
127
+        } else
129 128
         	throw new Exception('Please provide a database for message'.
130 129
         						' translation.');
131 130
        return $conn;
Please login to merge, or discard this patch.
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	function __construct($source)
67 67
 	{
68
-		$this->source = (string)$source;
69
-		$this->dns = parseDSN($this->source);
70
-		$this->db = $this->connect();
68
+		$this->source=(string) $source;
69
+		$this->dns=parseDSN($this->source);
70
+		$this->db=$this->connect();
71 71
 	}
72 72
 
73 73
 	/**
@@ -90,38 +90,38 @@  discard block
 block discarded – undo
90 90
 		if($conn!==null)
91 91
 			return $conn;
92 92
 		*/
93
-		$dsninfo = $this->dns;
93
+		$dsninfo=$this->dns;
94 94
 
95
-     	if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix')
96
-            $dbhost = ':' . $dsninfo['socket'];
95
+     	if(isset($dsninfo['protocol']) && $dsninfo['protocol']=='unix')
96
+            $dbhost=':'.$dsninfo['socket'];
97 97
         else
98 98
         {
99
-			$dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost';
100
-            if (!empty($dsninfo['port']))
101
-                $dbhost .= ':' . $dsninfo['port'];
99
+			$dbhost=$dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost';
100
+            if(!empty($dsninfo['port']))
101
+                $dbhost.=':'.$dsninfo['port'];
102 102
         }
103
-        $user = $dsninfo['username'];
104
-        $pw = $dsninfo['password'];
103
+        $user=$dsninfo['username'];
104
+        $pw=$dsninfo['password'];
105 105
 
106
-        $connect_function = 'mysql_connect';
106
+        $connect_function='mysql_connect';
107 107
 
108
-        if ($dbhost && $user && $pw)
109
-            $conn = @$connect_function($dbhost, $user, $pw);
110
-        elseif ($dbhost && $user)
111
-            $conn = @$connect_function($dbhost, $user);
112
-        elseif ($dbhost)
113
-            $conn = @$connect_function($dbhost);
108
+        if($dbhost && $user && $pw)
109
+            $conn=@$connect_function($dbhost, $user, $pw);
110
+        elseif($dbhost && $user)
111
+            $conn=@$connect_function($dbhost, $user);
112
+        elseif($dbhost)
113
+            $conn=@$connect_function($dbhost);
114 114
         else
115
-            $conn = false;
115
+            $conn=false;
116 116
 
117
-        if (empty($conn))
117
+        if(empty($conn))
118 118
         {
119 119
         	throw new Exception('Error in connecting to '.$dsninfo);
120 120
         }
121 121
 
122
-        if ($dsninfo['database'])
122
+        if($dsninfo['database'])
123 123
         {
124
-        	if (!@mysql_select_db($dsninfo['database'], $conn))
124
+        	if(!@mysql_select_db($dsninfo['database'], $conn))
125 125
         		throw new Exception('Error in connecting database, dns:'.
126 126
         							$dsninfo);
127 127
         }
@@ -148,25 +148,25 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	protected function &loadData($variant)
150 150
 	{
151
-		$variant = mysql_real_escape_string($variant);
151
+		$variant=mysql_real_escape_string($variant);
152 152
 
153
-		$statement =
153
+		$statement=
154 154
 			"SELECT t.id, t.source, t.target, t.comments
155 155
 				FROM trans_unit t, catalogue c
156 156
  				WHERE c.cat_id =  t.cat_id
157 157
 					AND c.name = '{$variant}'
158 158
 				ORDER BY id ASC";
159 159
 
160
-		$rs = mysql_query($statement,$this->db);
160
+		$rs=mysql_query($statement, $this->db);
161 161
 
162
-		$result = array();
162
+		$result=array();
163 163
 
164
-		while($row = mysql_fetch_array($rs,MYSQL_NUM))
164
+		while($row=mysql_fetch_array($rs, MYSQL_NUM))
165 165
 		{
166
-			$source = $row[1];
167
-			$result[$source][] = $row[2]; //target
168
-			$result[$source][] = $row[0]; //id
169
-			$result[$source][] = $row[3]; //comments
166
+			$source=$row[1];
167
+			$result[$source][]=$row[2]; //target
168
+			$result[$source][]=$row[0]; //id
169
+			$result[$source][]=$row[3]; //comments
170 170
 		}
171 171
 
172 172
 		return $result;
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	protected function getLastModified($source)
182 182
 	{
183
-		$source = mysql_real_escape_string($source);
183
+		$source=mysql_real_escape_string($source);
184 184
 
185
-		$rs = mysql_query(
185
+		$rs=mysql_query(
186 186
 			"SELECT date_modified FROM catalogue WHERE name = '{$source}'",
187 187
 			$this->db);
188 188
 
189
-		$result = $rs ? (int)mysql_result($rs,0) : 0;
189
+		$result=$rs ? (int) mysql_result($rs, 0) : 0;
190 190
 
191 191
 		return $result;
192 192
 	}
@@ -199,15 +199,15 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	protected function isValidSource($variant)
201 201
 	{
202
-		$variant = mysql_real_escape_string ($variant);
202
+		$variant=mysql_real_escape_string($variant);
203 203
 
204
-		$rs = mysql_query(
204
+		$rs=mysql_query(
205 205
 			"SELECT COUNT(*) FROM catalogue WHERE name = '{$variant}'",
206 206
 			$this->db);
207 207
 
208
-		$row = mysql_fetch_array($rs,MYSQL_NUM);
208
+		$row=mysql_fetch_array($rs, MYSQL_NUM);
209 209
 
210
-		$result = $row && $row[0] == '1';
210
+		$result=$row && $row[0]=='1';
211 211
 
212 212
 		return $result;
213 213
 	}
@@ -219,18 +219,18 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	protected function getCatalogueList($catalogue)
221 221
 	{
222
-		$variants = explode('_',$this->culture);
222
+		$variants=explode('_', $this->culture);
223 223
 
224
-		$catalogues = array($catalogue);
224
+		$catalogues=array($catalogue);
225 225
 
226
-		$variant = null;
226
+		$variant=null;
227 227
 
228
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
228
+		for($i=0, $k=count($variants); $i < $k; ++$i)
229 229
 		{
230 230
 			if(isset($variants[$i]{0}))
231 231
 			{
232
-				$variant .= ($variant)?'_'.$variants[$i]:$variants[$i];
233
-				$catalogues[] = $catalogue.'.'.$variant;
232
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
233
+				$catalogues[]=$catalogue.'.'.$variant;
234 234
 			}
235 235
 		}
236 236
 		return array_reverse($catalogues);
@@ -244,27 +244,27 @@  discard block
 block discarded – undo
244 244
 	private function getCatalogueDetails($catalogue='messages')
245 245
 	{
246 246
 		if(empty($catalogue))
247
-			$catalogue = 'messages';
247
+			$catalogue='messages';
248 248
 
249
-		$variant = $catalogue.'.'.$this->culture;
249
+		$variant=$catalogue.'.'.$this->culture;
250 250
 
251
-		$name = mysql_real_escape_string($this->getSource($variant));
251
+		$name=mysql_real_escape_string($this->getSource($variant));
252 252
 
253
-		$rs = mysql_query("SELECT cat_id
253
+		$rs=mysql_query("SELECT cat_id
254 254
 					FROM catalogue WHERE name = '{$name}'", $this->db);
255 255
 
256
-		if(mysql_num_rows($rs) != 1)
256
+		if(mysql_num_rows($rs)!=1)
257 257
 			return false;
258 258
 
259
-		$cat_id = (int)mysql_result($rs,0);
259
+		$cat_id=(int) mysql_result($rs, 0);
260 260
 
261 261
 		//first get the catalogue ID
262
-		$rs = mysql_query(
262
+		$rs=mysql_query(
263 263
 			"SELECT count(msg_id)
264 264
 				FROM trans_unit
265 265
 				WHERE cat_id = {$cat_id}", $this->db);
266 266
 
267
-		$count = (int)mysql_result($rs,0);
267
+		$count=(int) mysql_result($rs, 0);
268 268
 
269 269
 		return array($cat_id, $variant, $count);
270 270
 	}
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	private function updateCatalogueTime($cat_id, $variant)
277 277
 	{
278
-		$time = time();
278
+		$time=time();
279 279
 
280
-		$result = mysql_query("UPDATE catalogue
280
+		$result=mysql_query("UPDATE catalogue
281 281
 							SET date_modified = {$time}
282 282
 							WHERE cat_id = {$cat_id}", $this->db);
283 283
 
@@ -296,27 +296,27 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	function save($catalogue='messages')
298 298
 	{
299
-		$messages = $this->untranslated;
299
+		$messages=$this->untranslated;
300 300
 
301 301
 		if(count($messages) <= 0) return false;
302 302
 
303
-		$details = $this->getCatalogueDetails($catalogue);
303
+		$details=$this->getCatalogueDetails($catalogue);
304 304
 
305 305
 		if($details)
306
-			list($cat_id, $variant, $count) = $details;
306
+			list($cat_id, $variant, $count)=$details;
307 307
 		else
308 308
 			return false;
309 309
 
310 310
 		if($cat_id <= 0) return false;
311
-		$inserted = 0;
311
+		$inserted=0;
312 312
 
313
-		$time = time();
313
+		$time=time();
314 314
 
315 315
 		foreach($messages as $message)
316 316
 		{
317 317
 			$count++; $inserted++;
318
-			$message = mysql_real_escape_string($message);
319
-			$statement = "INSERT INTO trans_unit
318
+			$message=mysql_real_escape_string($message);
319
+			$statement="INSERT INTO trans_unit
320 320
 				(cat_id,id,source,date_added) VALUES
321 321
 				({$cat_id}, {$count},'{$message}',$time)";
322 322
 			mysql_query($statement, $this->db);
@@ -335,22 +335,22 @@  discard block
 block discarded – undo
335 335
 	 */
336 336
 	function delete($message, $catalogue='messages')
337 337
 	{
338
-		$details = $this->getCatalogueDetails($catalogue);
338
+		$details=$this->getCatalogueDetails($catalogue);
339 339
 		if($details)
340
-			list($cat_id, $variant, $count) = $details;
340
+			list($cat_id, $variant, $count)=$details;
341 341
 		else
342 342
 			return false;
343 343
 
344
-		$text = mysql_real_escape_string($message);
344
+		$text=mysql_real_escape_string($message);
345 345
 
346
-		$statement = "DELETE FROM trans_unit WHERE
346
+		$statement="DELETE FROM trans_unit WHERE
347 347
 						cat_id = {$cat_id} AND source = '{$message}'";
348
-		$deleted = false;
348
+		$deleted=false;
349 349
 
350 350
 		mysql_query($statement, $this->db);
351 351
 
352
-		if(mysql_affected_rows($this->db) == 1)
353
-			$deleted = $this->updateCatalogueTime($cat_id, $variant);
352
+		if(mysql_affected_rows($this->db)==1)
353
+			$deleted=$this->updateCatalogueTime($cat_id, $variant);
354 354
 
355 355
 		return $deleted;
356 356
 
@@ -366,30 +366,30 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	function update($text, $target, $comments, $catalogue='messages')
368 368
 	{
369
-		$details = $this->getCatalogueDetails($catalogue);
369
+		$details=$this->getCatalogueDetails($catalogue);
370 370
 		if($details)
371
-			list($cat_id, $variant, $count) = $details;
371
+			list($cat_id, $variant, $count)=$details;
372 372
 		else
373 373
 			return false;
374 374
 
375
-		$comments = mysql_real_escape_string($comments);
376
-		$target = mysql_real_escape_string($target);
377
-		$text = mysql_real_escape_string($text);
375
+		$comments=mysql_real_escape_string($comments);
376
+		$target=mysql_real_escape_string($target);
377
+		$text=mysql_real_escape_string($text);
378 378
 
379
-		$time = time();
379
+		$time=time();
380 380
 
381
-		$statement = "UPDATE trans_unit SET
381
+		$statement="UPDATE trans_unit SET
382 382
 						target = '{$target}',
383 383
 						comments = '{$comments}',
384 384
 						date_modified = '{$time}'
385 385
 					WHERE cat_id = {$cat_id}
386 386
 						AND source = '{$text}'";
387 387
 
388
-		$updated = false;
388
+		$updated=false;
389 389
 
390 390
 		mysql_query($statement, $this->db);
391
-		if(mysql_affected_rows($this->db) == 1)
392
-			$updated = $this->updateCatalogueTime($cat_id, $variant);
391
+		if(mysql_affected_rows($this->db)==1)
392
+			$updated=$this->updateCatalogueTime($cat_id, $variant);
393 393
 
394 394
 		return $updated;
395 395
 	}
@@ -400,15 +400,15 @@  discard block
 block discarded – undo
400 400
 	 */
401 401
 	function catalogues()
402 402
 	{
403
-		$statement = 'SELECT name FROM catalogue ORDER BY name';
404
-		$rs = mysql_query($statement, $this->db);
405
-		$result = array();
406
-		while($row = mysql_fetch_array($rs,MYSQL_NUM))
403
+		$statement='SELECT name FROM catalogue ORDER BY name';
404
+		$rs=mysql_query($statement, $this->db);
405
+		$result=array();
406
+		while($row=mysql_fetch_array($rs, MYSQL_NUM))
407 407
 		{
408
-			$details = explode('.',$row[0]);
409
-			if(!isset($details[1])) $details[1] = null;
408
+			$details=explode('.', $row[0]);
409
+			if(!isset($details[1])) $details[1]=null;
410 410
 
411
-			$result[] = $details;
411
+			$result[]=$details;
412 412
 		}
413 413
 		return $result;
414 414
 	}
Please login to merge, or discard this patch.
framework/Util/TDataFieldAccessor.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
 				$tmp = $data;
61 61
 				foreach (explode(".", $field) as $f)
62
-				    $tmp = $tmp[$f];
62
+					$tmp = $tmp[$f];
63 63
 				return $tmp;
64 64
 			}
65 65
 			else if(is_object($data))
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @return mixed value at the specified field
49 49
 	 * @throws TInvalidDataValueException if field or data is invalid
50 50
 	 */
51
-	public static function getDataFieldValue($data,$field)
51
+	public static function getDataFieldValue($data, $field)
52 52
 	{
53 53
 		try
54 54
 		{
@@ -57,33 +57,33 @@  discard block
 block discarded – undo
57 57
 				if(isset($data[$field]))
58 58
 					return $data[$field];
59 59
 
60
-				$tmp = $data;
61
-				foreach (explode(".", $field) as $f)
62
-				    $tmp = $tmp[$f];
60
+				$tmp=$data;
61
+				foreach(explode(".", $field) as $f)
62
+				    $tmp=$tmp[$f];
63 63
 				return $tmp;
64 64
 			}
65 65
 			else if(is_object($data))
66 66
 			{
67
-				if(strpos($field,'.')===false)  // simple field
67
+				if(strpos($field, '.')===false)  // simple field
68 68
 				{
69 69
 					if(method_exists($data, 'get'.$field))
70
-						return call_user_func(array($data,'get'.$field));
70
+						return call_user_func(array($data, 'get'.$field));
71 71
 					else
72 72
 						return $data->{$field};
73 73
 				}
74 74
 				else // field in the format of xxx.yyy.zzz
75 75
 				{
76 76
 					$object=$data;
77
-					foreach(explode('.',$field) as $f)
78
-						$object = TDataFieldAccessor::getDataFieldValue($object, $f);
77
+					foreach(explode('.', $field) as $f)
78
+						$object=TDataFieldAccessor::getDataFieldValue($object, $f);
79 79
 					return $object;
80 80
 				}
81 81
 			}
82 82
 		}
83 83
 		catch(Exception $e)
84 84
 		{
85
-			throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid',$field,$e->getMessage());
85
+			throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid', $field, $e->getMessage());
86 86
 		}
87
-		throw new TInvalidDataValueException('datafieldaccessor_data_invalid',$field);
87
+		throw new TInvalidDataValueException('datafieldaccessor_data_invalid', $field);
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
 				foreach (explode(".", $field) as $f)
62 62
 				    $tmp = $tmp[$f];
63 63
 				return $tmp;
64
-			}
65
-			else if(is_object($data))
64
+			} else if(is_object($data))
66 65
 			{
67 66
 				if(strpos($field,'.')===false)  // simple field
68 67
 				{
@@ -70,8 +69,7 @@  discard block
 block discarded – undo
70 69
 						return call_user_func(array($data,'get'.$field));
71 70
 					else
72 71
 						return $data->{$field};
73
-				}
74
-				else // field in the format of xxx.yyy.zzz
72
+				} else // field in the format of xxx.yyy.zzz
75 73
 				{
76 74
 					$object=$data;
77 75
 					foreach(explode('.',$field) as $f)
@@ -79,8 +77,7 @@  discard block
 block discarded – undo
79 77
 					return $object;
80 78
 				}
81 79
 			}
82
-		}
83
-		catch(Exception $e)
80
+		} catch(Exception $e)
84 81
 		{
85 82
 			throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid',$field,$e->getMessage());
86 83
 		}
Please login to merge, or discard this patch.
framework/Web/Services/TFeedService.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -139,9 +139,9 @@
 block discarded – undo
139 139
 			$feed->init($feedConfig);
140 140
 
141 141
 			$content=$feed->getFeedContent();
142
-		    //$this->getResponse()->setContentType('application/rss+xml');
143
-		    $this->getResponse()->setContentType($feed->getContentType());
144
-		    $this->getResponse()->write($content);
142
+			//$this->getResponse()->setContentType('application/rss+xml');
143
+			$this->getResponse()->setContentType($feed->getContentType());
144
+			$this->getResponse()->write($content);
145 145
 		}
146 146
 		else
147 147
 			throw new THttpException(404,'feedservice_feed_unknown',$id);
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			if(is_array($config))
78 78
 			{
79 79
 				foreach($config as $id => $feed)
80
-					$this->_feeds[$id] = $feed;
80
+					$this->_feeds[$id]=$feed;
81 81
 			}
82 82
 		}
83 83
 		else
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
 		if(isset($this->_feeds[$id]))
111 111
 		{
112 112
 			$feedConfig=$this->_feeds[$id];
113
-			$properties = array();
114
-			$feed = null;
113
+			$properties=array();
114
+			$feed=null;
115 115
 			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
116 116
 			{
117 117
 				if(isset($feedConfig['class']))
118 118
 				{
119 119
 					$feed=Prado::createComponent($feedConfig['class']);
120 120
 					if($service instanceof IFeedContentProvider)
121
-						$properties=isset($feedConfig['properties'])?$feedConfig['properties']:array();
121
+						$properties=isset($feedConfig['properties']) ? $feedConfig['properties'] : array();
122 122
 					else
123
-						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
123
+						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
124 124
 				}
125 125
 				else
126
-					throw new TConfigurationException('jsonservice_class_required',$id);
126
+					throw new TConfigurationException('jsonservice_class_required', $id);
127 127
 			}
128 128
 			else
129 129
 			{
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 				{
133 133
 					$feed=Prado::createComponent($class);
134 134
 					if(!($feed instanceof IFeedContentProvider))
135
-						throw new TConfigurationException('feedservice_feedtype_invalid',$id);
135
+						throw new TConfigurationException('feedservice_feedtype_invalid', $id);
136 136
 				}
137 137
 				else
138
-					throw new TConfigurationException('feedservice_class_required',$id);
138
+					throw new TConfigurationException('feedservice_class_required', $id);
139 139
 			}
140 140
 
141 141
 			// init feed properties
142 142
 			foreach($properties as $name=>$value)
143
-				$feed->setSubproperty($name,$value);
143
+				$feed->setSubproperty($name, $value);
144 144
 			$feed->init($feedConfig);
145 145
 
146 146
 			$content=$feed->getFeedContent();
@@ -149,6 +149,6 @@  discard block
 block discarded – undo
149 149
 		    $this->getResponse()->write($content);
150 150
 		}
151 151
 		else
152
-			throw new THttpException(404,'feedservice_feed_unknown',$id);
152
+			throw new THttpException(404, 'feedservice_feed_unknown', $id);
153 153
 	}
154 154
 }
155 155
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
 				foreach($config as $id => $feed)
80 80
 					$this->_feeds[$id] = $feed;
81 81
 			}
82
-		}
83
-		else
82
+		} else
84 83
 		{
85 84
 			foreach($config->getElementsByTagName('feed') as $feed)
86 85
 			{
@@ -121,11 +120,9 @@  discard block
 block discarded – undo
121 120
 						$properties=isset($feedConfig['properties'])?$feedConfig['properties']:array();
122 121
 					else
123 122
 						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
124
-				}
125
-				else
123
+				} else
126 124
 					throw new TConfigurationException('jsonservice_class_required',$id);
127
-			}
128
-			else
125
+			} else
129 126
 			{
130 127
 				$properties=$feedConfig->getAttributes();
131 128
 				if(($class=$properties->remove('class'))!==null)
@@ -133,8 +130,7 @@  discard block
 block discarded – undo
133 130
 					$feed=Prado::createComponent($class);
134 131
 					if(!($feed instanceof IFeedContentProvider))
135 132
 						throw new TConfigurationException('feedservice_feedtype_invalid',$id);
136
-				}
137
-				else
133
+				} else
138 134
 					throw new TConfigurationException('feedservice_class_required',$id);
139 135
 			}
140 136
 
@@ -147,8 +143,7 @@  discard block
 block discarded – undo
147 143
 		    //$this->getResponse()->setContentType('application/rss+xml');
148 144
 		    $this->getResponse()->setContentType($feed->getContentType());
149 145
 		    $this->getResponse()->write($content);
150
-		}
151
-		else
146
+		} else
152 147
 			throw new THttpException(404,'feedservice_feed_unknown',$id);
153 148
 	}
154 149
 }
155 150
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/TCachePageStatePersister.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -144,15 +144,15 @@
 block discarded – undo
144 144
 	 */
145 145
 	public function getKeyPrefix()
146 146
 	{
147
-	    return $this->_prefix;
147
+		return $this->_prefix;
148 148
 	}
149 149
 
150 150
 	/**
151
-     * @param string prefix of cache variable name to avoid conflict with other cache data
152
-     */
151
+	 * @param string prefix of cache variable name to avoid conflict with other cache data
152
+	 */
153 153
 	public function setKeyPrefix($value)
154 154
 	{
155
-	    $this->_prefix=$value;
155
+		$this->_prefix=$value;
156 156
 	}
157 157
 
158 158
 	/**
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			if($cache===null || !($cache instanceof ICache))
111 111
 			{
112 112
 				if($this->_cacheModuleID!=='')
113
-					throw new TConfigurationException('cachepagestatepersister_cachemoduleid_invalid',$this->_cacheModuleID);
113
+					throw new TConfigurationException('cachepagestatepersister_cachemoduleid_invalid', $this->_cacheModuleID);
114 114
 				else
115 115
 					throw new TConfigurationException('cachepagestatepersister_cache_required');
116 116
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function setCacheTimeout($value)
135 135
 	{
136
-		if(($value=TPropertyValue::ensureInteger($value))>=0)
136
+		if(($value=TPropertyValue::ensureInteger($value)) >= 0)
137 137
 			$this->_timeout=$value;
138 138
 		else
139 139
 			throw new TInvalidDataValueException('cachepagestatepersister_timeout_invalid');
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	public function save($data)
175 175
 	{
176
-		$timestamp=(string)microtime(true);
176
+		$timestamp=(string) microtime(true);
177 177
 		$key=$this->calculateKey($timestamp);
178
-		$this->getCache()->add($key,$data,$this->_timeout);
179
-		$this->_page->setClientState(TPageStateFormatter::serialize($this->_page,$timestamp));
178
+		$this->getCache()->add($key, $data, $this->_timeout);
179
+		$this->_page->setClientState(TPageStateFormatter::serialize($this->_page, $timestamp));
180 180
 	}
181 181
 
182 182
 	/**
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function load()
188 188
 	{
189
-		if(($timestamp=TPageStateFormatter::unserialize($this->_page,$this->_page->getRequestClientState()))!==null)
189
+		if(($timestamp=TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState()))!==null)
190 190
 		{
191 191
 			$key=$this->calculateKey($timestamp);
192 192
 			if(($data=$this->getCache()->get($key))!==false)
193 193
 				return $data;
194 194
 		}
195
-		throw new THttpException(400,'cachepagestatepersister_pagestate_corrupted');
195
+		throw new THttpException(400, 'cachepagestatepersister_pagestate_corrupted');
196 196
 	}
197 197
 }
198 198
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TAccordion.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -180,24 +180,24 @@  discard block
 block discarded – undo
180 180
 	}
181 181
 
182 182
 	/**
183
-	* @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''.
184
-	*/
183
+	 * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''.
184
+	 */
185 185
 	public function getCssUrl()
186 186
 	{
187 187
 		return $this->getViewState('CssUrl','default');
188 188
 	}
189 189
 
190 190
 	/**
191
-	* @param string URL for the CSS file including all relevant CSS class definitions.
192
-	*/
191
+	 * @param string URL for the CSS file including all relevant CSS class definitions.
192
+	 */
193 193
 	public function setCssUrl($value)
194 194
 	{
195 195
 		$this->setViewState('CssUrl',TPropertyValue::ensureString($value),'');
196 196
 	}
197 197
 
198 198
 	/**
199
-		* @return string CSS class for the whole accordion control div.
200
-	*/
199
+	 * @return string CSS class for the whole accordion control div.
200
+	 */
201 201
 	public function getCssClass()
202 202
 	{
203 203
 		$cssClass=parent::getCssClass();
@@ -205,32 +205,32 @@  discard block
 block discarded – undo
205 205
 	}
206 206
 
207 207
 	/**
208
-		* @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'.
209
-	*/
208
+	 * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'.
209
+	 */
210 210
 	public function getViewCssClass()
211 211
 	{
212 212
 		return $this->getViewStyle()->getCssClass();
213 213
 	}
214 214
 
215 215
 	/**
216
-	* @param string CSS class for the currently displayed view div.
217
-	*/
216
+	 * @param string CSS class for the currently displayed view div.
217
+	 */
218 218
 	public function setViewCssClass($value)
219 219
 	{
220 220
 		$this->getViewStyle()->setCssClass($value);
221 221
 	}
222 222
 
223 223
 	/**
224
-		* @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'.
225
-	*/
224
+	 * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'.
225
+	 */
226 226
 	public function getAnimationDuration()
227 227
 	{
228 228
 		return $this->getViewState('AnimationDuration','1');
229 229
 	}
230 230
 
231 231
 	/**
232
-	* @param string CSS class for the currently displayed view div.
233
-	*/
232
+	 * @param string CSS class for the currently displayed view div.
233
+	 */
234 234
 	public function setAnimationDuration($value)
235 235
 	{
236 236
 		$this->setViewState('AnimationDuration',$value);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -136,15 +136,13 @@  discard block
 block discarded – undo
136 136
 				$activeView=$views->itemAt($index);
137 137
 			else
138 138
 				throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id);
139
-		}
140
-		else if(($index=$this->getActiveViewIndex())>=0)
139
+		} else if(($index=$this->getActiveViewIndex())>=0)
141 140
 		{
142 141
 			if($index<$views->getCount())
143 142
 				$activeView=$views->itemAt($index);
144 143
 			else
145 144
 				throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index);
146
-		}
147
-		else
145
+		} else
148 146
 		{
149 147
 			foreach($views as $index=>$view)
150 148
 			{
@@ -320,8 +318,7 @@  discard block
 block discarded – undo
320 318
 				$this->setActiveViewIndex($index);
321 319
 				$this->setActiveViewID($view->getID(false));
322 320
 				$view->setActive(true);
323
-			}
324
-			else
321
+			} else
325 322
 				$v->setActive(false);
326 323
 		}
327 324
 	}
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function getActiveViewIndex()
102 102
 	{
103
-		return $this->getViewState('ActiveViewIndex',0);
103
+		return $this->getViewState('ActiveViewIndex', 0);
104 104
 	}
105 105
 
106 106
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function setActiveViewIndex($value)
111 111
 	{
112
-		$this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0);
112
+		$this->setViewState('ActiveViewIndex', TPropertyValue::ensureInteger($value), 0);
113 113
 		$this->setActiveViewID('');
114 114
 	}
115 115
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getActiveViewID()
123 123
 	{
124
-		return $this->getViewState('ActiveViewID','');
124
+		return $this->getViewState('ActiveViewID', '');
125 125
 	}
126 126
 
127 127
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function setActiveViewID($value)
131 131
 	{
132
-		$this->setViewState('ActiveViewID',$value,'');
132
+		$this->setViewState('ActiveViewID', $value, '');
133 133
 	}
134 134
 
135 135
 	/**
@@ -145,17 +145,17 @@  discard block
 block discarded – undo
145 145
 		$views=$this->getViews();
146 146
 		if(($id=$this->getActiveViewID())!=='')
147 147
 		{
148
-			if(($index=$views->findIndexByID($id))>=0)
148
+			if(($index=$views->findIndexByID($id)) >= 0)
149 149
 				$activeView=$views->itemAt($index);
150 150
 			else
151
-				throw new TInvalidDataValueException('accordion_activeviewid_invalid',$id);
151
+				throw new TInvalidDataValueException('accordion_activeviewid_invalid', $id);
152 152
 		}
153
-		else if(($index=$this->getActiveViewIndex())>=0)
153
+		else if(($index=$this->getActiveViewIndex()) >= 0)
154 154
 		{
155
-			if($index<$views->getCount())
155
+			if($index < $views->getCount())
156 156
 				$activeView=$views->itemAt($index);
157 157
 			else
158
-				throw new TInvalidDataValueException('accordion_activeviewindex_invalid',$index);
158
+				throw new TInvalidDataValueException('accordion_activeviewindex_invalid', $index);
159 159
 		}
160 160
 		else
161 161
 		{
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function setActiveView($view)
181 181
 	{
182
-		if($this->getViews()->indexOf($view)>=0)
182
+		if($this->getViews()->indexOf($view) >= 0)
183 183
 			$this->activateView($view);
184 184
 		else
185 185
 			throw new TInvalidOperationException('accordion_view_inexistent');
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	*/
191 191
 	public function getCssUrl()
192 192
 	{
193
-		return $this->getViewState('CssUrl','default');
193
+		return $this->getViewState('CssUrl', 'default');
194 194
 	}
195 195
 
196 196
 	/**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	*/
199 199
 	public function setCssUrl($value)
200 200
 	{
201
-		$this->setViewState('CssUrl',TPropertyValue::ensureString($value),'');
201
+		$this->setViewState('CssUrl', TPropertyValue::ensureString($value), '');
202 202
 	}
203 203
 
204 204
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	public function getCssClass()
208 208
 	{
209 209
 		$cssClass=parent::getCssClass();
210
-			return $cssClass===''?'accordion':$cssClass;
210
+			return $cssClass==='' ? 'accordion' : $cssClass;
211 211
 	}
212 212
 
213 213
 	/**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	*/
232 232
 	public function getAnimationDuration()
233 233
 	{
234
-		return $this->getViewState('AnimationDuration','1');
234
+		return $this->getViewState('AnimationDuration', '1');
235 235
 	}
236 236
 
237 237
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	*/
240 240
 	public function setAnimationDuration($value)
241 241
 	{
242
-		$this->setViewState('AnimationDuration',$value);
242
+		$this->setViewState('AnimationDuration', $value);
243 243
 	}
244 244
 
245 245
 	/**
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function getViewStyle()
249 249
 	{
250
-		if(($style=$this->getViewState('ViewStyle',null))===null)
250
+		if(($style=$this->getViewState('ViewStyle', null))===null)
251 251
 		{
252 252
 			$style=new TStyle;
253 253
 			$style->setCssClass('accordion-view');
254
-			$this->setViewState('ViewStyle',$style,null);
254
+			$this->setViewState('ViewStyle', $style, null);
255 255
 		}
256 256
 		return $style;
257 257
 	}
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public function getHeaderStyle()
279 279
 	{
280
-		if(($style=$this->getViewState('HeaderStyle',null))===null)
280
+		if(($style=$this->getViewState('HeaderStyle', null))===null)
281 281
 		{
282 282
 			$style=new TStyle;
283 283
 			$style->setCssClass('accordion-header');
284
-			$this->setViewState('HeaderStyle',$style,null);
284
+			$this->setViewState('HeaderStyle', $style, null);
285 285
 		}
286 286
 		return $style;
287 287
 	}
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
 	 */
308 308
 	public function getActiveHeaderStyle()
309 309
 	{
310
-		if(($style=$this->getViewState('ActiveHeaderStyle',null))===null)
310
+		if(($style=$this->getViewState('ActiveHeaderStyle', null))===null)
311 311
 		{
312 312
 			$style=new TStyle;
313 313
 			$style->setCssClass('accordion-header-active');
314
-			$this->setViewState('ActiveHeaderStyle',$style,null);
314
+			$this->setViewState('ActiveHeaderStyle', $style, null);
315 315
 		}
316 316
 		return $style;
317 317
 	}
@@ -361,11 +361,11 @@  discard block
 block discarded – undo
361 361
 	 * @param array the input data collection
362 362
 	 * @return boolean whether the data of the control has been changed
363 363
 	 */
364
-	public function loadPostData($key,$values)
364
+	public function loadPostData($key, $values)
365 365
 	{
366 366
 		if(($index=$values[$this->getClientID().'_1'])!==null)
367 367
 		{
368
-			$index=(int)$index;
368
+			$index=(int) $index;
369 369
 			$currentIndex=$this->getActiveViewIndex();
370 370
 			if($currentIndex!==$index)
371 371
 			{
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 */
406 406
 	protected function addAttributesToRender($writer)
407 407
 	{
408
-		$writer->addAttribute('id',$this->getClientID());
408
+		$writer->addAttribute('id', $this->getClientID());
409 409
 		$this->setCssClass($this->getCssClass());
410 410
 		parent::addAttributesToRender($writer);
411 411
 	}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	public function onPreRender($param)
419 419
 	{
420 420
 		parent::onPreRender($param);
421
-		$this->getActiveView();  // determine the active view
421
+		$this->getActiveView(); // determine the active view
422 422
 		$this->registerStyleSheet();
423 423
 	}
424 424
 
@@ -429,17 +429,17 @@  discard block
 block discarded – undo
429 429
 	 */
430 430
 	protected function registerStyleSheet()
431 431
 	{
432
-		$url = $this->getCssUrl();
432
+		$url=$this->getCssUrl();
433 433
 
434
-		if($url === '') {
434
+		if($url==='') {
435 435
 			return;
436 436
 		}
437 437
 
438
-		if($url === 'default') {
439
-			$url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'accordion.css');
438
+		if($url==='default') {
439
+			$url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'accordion.css');
440 440
 		}
441 441
 
442
-		if($url !== '') {
442
+		if($url!=='') {
443 443
 			$this->getPage()->getClientScript()->registerStyleSheetFile($url, $url);
444 444
 		}
445 445
 	}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 		$code="new $className($options);";
459 459
 		$cs->registerEndScript("prado:$id", $code);
460 460
 		// ensure an item is always active and visible
461
-		$index = $this->getActiveViewIndex();
461
+		$index=$this->getActiveViewIndex();
462 462
 		if(!$this->getViews()->itemAt($index)->Visible)
463 463
 			$index=0;
464 464
 		$cs->registerHiddenField($id.'_1', $index);
@@ -481,17 +481,17 @@  discard block
 block discarded – undo
481 481
 	 */
482 482
 	protected function getClientOptions()
483 483
 	{
484
-		$options['ID'] = $this->getClientID();
485
-		$options['ActiveHeaderCssClass'] = $this->getActiveHeaderCssClass();
486
-		$options['HeaderCssClass'] = $this->getHeaderCssClass();
487
-		$options['Duration'] = $this->getAnimationDuration();
484
+		$options['ID']=$this->getClientID();
485
+		$options['ActiveHeaderCssClass']=$this->getActiveHeaderCssClass();
486
+		$options['HeaderCssClass']=$this->getHeaderCssClass();
487
+		$options['Duration']=$this->getAnimationDuration();
488 488
 
489
-		if (($viewheight = $this->getViewHeight())>0)
490
-			$options['maxHeight'] = $viewheight;
491
-		$views = array();
489
+		if(($viewheight=$this->getViewHeight()) > 0)
490
+			$options['maxHeight']=$viewheight;
491
+		$views=array();
492 492
 		foreach($this->getViews() as $view)
493
-			$views[$view->getClientID()] = $view->getVisible() ? '1': '0';
494
-		$options['Views'] = $views;
493
+			$views[$view->getClientID()]=$view->getVisible() ? '1' : '0';
494
+		$options['Views']=$views;
495 495
 
496 496
 		return $options;
497 497
 	}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	public function renderContents($writer)
527 527
 	{
528 528
 		$views=$this->getViews();
529
-		if($views->getCount()>0)
529
+		if($views->getCount() > 0)
530 530
 		{
531 531
 			$writer->writeLine();
532 532
 			foreach($views as $view)
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TXmlTransform.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -46,50 +46,50 @@  discard block
 block discarded – undo
46 46
    * @throws TConfigurationException If XSL extension is not available
47 47
    */
48 48
   public function __construct() {
49
-    if(!class_exists('XSLTProcessor', false)) {
50
-      throw new TConfigurationException('xmltransform_xslextension_required');
51
-    }
49
+	if(!class_exists('XSLTProcessor', false)) {
50
+	  throw new TConfigurationException('xmltransform_xslextension_required');
51
+	}
52 52
   }
53 53
 
54 54
   /**
55 55
    * @return string The path to the XML style sheet.
56 56
    */
57 57
   public function getTransformPath() {
58
-    return $this->getViewState('TransformPath', '');
58
+	return $this->getViewState('TransformPath', '');
59 59
   }
60 60
 
61 61
   /**
62 62
    * @param string The path to the XML style sheet.  It must be in namespace format.
63 63
    */
64 64
   public function setTransformPath($value) {
65
-    if(!is_file($value)) {
66
-      $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE);
67
-      if($value === null) {
65
+	if(!is_file($value)) {
66
+	  $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE);
67
+	  if($value === null) {
68 68
 	throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value);
69
-      }
70
-    }
71
-    $this->setViewState('TransformPath', $value, '');
69
+	  }
70
+	}
71
+	$this->setViewState('TransformPath', $value, '');
72 72
   }
73 73
 
74 74
   /**
75 75
    * @return string XML style sheet as string
76 76
    */
77 77
   public function getTransformContent() {
78
-    return $this->getViewState('TransformContent', '');
78
+	return $this->getViewState('TransformContent', '');
79 79
   }
80 80
 
81 81
   /**
82 82
    * @param string $value XML style sheet as string
83 83
    */
84 84
   public function setTransformContent($value) {
85
-    $this->setViewState('TransformContent', $value, '');
85
+	$this->setViewState('TransformContent', $value, '');
86 86
   }
87 87
 
88 88
   /**
89 89
    * @return string The path to the XML document. It must be in namespace format.
90 90
    */
91 91
   public function getDocumentPath() {
92
-    return $this->getViewState('DocumentPath', '');
92
+	return $this->getViewState('DocumentPath', '');
93 93
   }
94 94
 
95 95
   /**
@@ -97,27 +97,27 @@  discard block
 block discarded – undo
97 97
    * @throws TInvalidDataValueException
98 98
    */
99 99
   public function setDocumentPath($value) {
100
-    if(!is_file($value)) {
101
-      $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE);
102
-      if($value === null) {
100
+	if(!is_file($value)) {
101
+	  $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE);
102
+	  if($value === null) {
103 103
 	throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value);
104
-      }
105
-    }
106
-    $this->setViewState('DocumentPath', $value, '');
104
+	  }
105
+	}
106
+	$this->setViewState('DocumentPath', $value, '');
107 107
   }
108 108
 
109 109
   /**
110 110
    * @return string XML data
111 111
    */
112 112
   public function getDocumentContent() {
113
-    return $this->getViewState('DocumentContent', '');
113
+	return $this->getViewState('DocumentContent', '');
114 114
   }
115 115
 
116 116
   /**
117 117
    * @param string $value XML data. If not empty, it takes precedence over {@link setDocumentPath DocumentPath}.
118 118
    */
119 119
   public function setDocumentContent($value) {
120
-    $this->setViewState('DocumentContent', $value, '');
120
+	$this->setViewState('DocumentContent', $value, '');
121 121
   }
122 122
 
123 123
   /**
@@ -125,41 +125,41 @@  discard block
 block discarded – undo
125 125
    * @return TAttributeCollection the list of custom parameters
126 126
    */
127 127
   public function getParameters() {
128
-    if($params = $this->getViewState('Parameters',null)) {
129
-      return $params;
130
-    } else {
131
-      $params = new TAttributeCollection();
132
-      $this->setViewState('Parameters', $params, null);
133
-      return $params;
134
-    }
128
+	if($params = $this->getViewState('Parameters',null)) {
129
+	  return $params;
130
+	} else {
131
+	  $params = new TAttributeCollection();
132
+	  $this->setViewState('Parameters', $params, null);
133
+	  return $params;
134
+	}
135 135
   }
136 136
 
137 137
   private function getTransformXmlDocument() {
138
-    if(($content = $this->getTransformContent()) !== '') {
139
-      $document = new DOMDocument();
140
-      $document->loadXML($content);
141
-      return $document;
142
-    } else if(($path = $this->getTransformPath()) !== '') {
143
-      $document = new DOMDocument();
144
-      $document->load($path);
145
-      return $document;
146
-    } else {
147
-      throw new TConfigurationException('xmltransform_transform_required');
148
-    }
138
+	if(($content = $this->getTransformContent()) !== '') {
139
+	  $document = new DOMDocument();
140
+	  $document->loadXML($content);
141
+	  return $document;
142
+	} else if(($path = $this->getTransformPath()) !== '') {
143
+	  $document = new DOMDocument();
144
+	  $document->load($path);
145
+	  return $document;
146
+	} else {
147
+	  throw new TConfigurationException('xmltransform_transform_required');
148
+	}
149 149
   }
150 150
 
151 151
   private function getSourceXmlDocument() {
152
-    if(($content = $this->getDocumentContent()) !== '') {
153
-      $document = new DOMDocument();
154
-      $document->loadXML($content);
155
-      return $document;
156
-    } else if(($path = $this->getDocumentPath()) !== '') {
157
-      $document = new DOMDocument();
158
-      $document->load($path);
159
-      return $document;
160
-    } else {
161
-      return null;
162
-    }
152
+	if(($content = $this->getDocumentContent()) !== '') {
153
+	  $document = new DOMDocument();
154
+	  $document->loadXML($content);
155
+	  return $document;
156
+	} else if(($path = $this->getDocumentPath()) !== '') {
157
+	  $document = new DOMDocument();
158
+	  $document->load($path);
159
+	  return $document;
160
+	} else {
161
+	  return null;
162
+	}
163 163
   }
164 164
 
165 165
   /**
@@ -167,27 +167,27 @@  discard block
 block discarded – undo
167 167
    * @param THtmlWriter The writer used for the rendering purpose
168 168
    */
169 169
   public function render($writer) {
170
-    if(($document=$this->getSourceXmlDocument()) === null) {
170
+	if(($document=$this->getSourceXmlDocument()) === null) {
171 171
 	  $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
172 172
 	  parent::render($htmlWriter);
173
-      $document = new DOMDocument();
174
-      $document->loadXML($htmlWriter->flush());
175
-    }
176
-    $stylesheet = $this->getTransformXmlDocument();
177
-
178
-    // Perform XSL transformation
179
-    $xslt = new XSLTProcessor();
180
-    $xslt->importStyleSheet($stylesheet);
181
-
182
-    // Check for parameters
183
-    $parameters = $this->getParameters();
184
-    foreach($parameters as $name => $value) {
185
-      $xslt->setParameter('', $name, $value);
186
-    }
187
-    $output = $xslt->transformToXML($document);
188
-
189
-    // Write output
190
-    $writer->write($output);
173
+	  $document = new DOMDocument();
174
+	  $document->loadXML($htmlWriter->flush());
175
+	}
176
+	$stylesheet = $this->getTransformXmlDocument();
177
+
178
+	// Perform XSL transformation
179
+	$xslt = new XSLTProcessor();
180
+	$xslt->importStyleSheet($stylesheet);
181
+
182
+	// Check for parameters
183
+	$parameters = $this->getParameters();
184
+	foreach($parameters as $name => $value) {
185
+	  $xslt->setParameter('', $name, $value);
186
+	}
187
+	$output = $xslt->transformToXML($document);
188
+
189
+	// Write output
190
+	$writer->write($output);
191 191
   }
192 192
 }
193 193
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class TXmlTransform extends TControl {
38 38
 
39
-  const EXT_XML_FILE = '.xml';
40
-  const EXT_XSL_FILE = '.xsl';
39
+  const EXT_XML_FILE='.xml';
40
+  const EXT_XSL_FILE='.xsl';
41 41
 
42 42
   /**
43 43
    * Constructor
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
    */
64 64
   public function setTransformPath($value) {
65 65
     if(!is_file($value)) {
66
-      $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE);
67
-      if($value === null) {
66
+      $value=Prado::getPathOfNamespace($value, self::EXT_XSL_FILE);
67
+      if($value===null) {
68 68
 	throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value);
69 69
       }
70 70
     }
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
    */
99 99
   public function setDocumentPath($value) {
100 100
     if(!is_file($value)) {
101
-      $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE);
102
-      if($value === null) {
101
+      $value=Prado::getPathOfNamespace($value, self::EXT_XML_FILE);
102
+      if($value===null) {
103 103
 	throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value);
104 104
       }
105 105
     }
@@ -125,22 +125,22 @@  discard block
 block discarded – undo
125 125
    * @return TAttributeCollection the list of custom parameters
126 126
    */
127 127
   public function getParameters() {
128
-    if($params = $this->getViewState('Parameters',null)) {
128
+    if($params=$this->getViewState('Parameters', null)) {
129 129
       return $params;
130 130
     } else {
131
-      $params = new TAttributeCollection();
131
+      $params=new TAttributeCollection();
132 132
       $this->setViewState('Parameters', $params, null);
133 133
       return $params;
134 134
     }
135 135
   }
136 136
 
137 137
   private function getTransformXmlDocument() {
138
-    if(($content = $this->getTransformContent()) !== '') {
139
-      $document = new DOMDocument();
138
+    if(($content=$this->getTransformContent())!=='') {
139
+      $document=new DOMDocument();
140 140
       $document->loadXML($content);
141 141
       return $document;
142
-    } else if(($path = $this->getTransformPath()) !== '') {
143
-      $document = new DOMDocument();
142
+    } else if(($path=$this->getTransformPath())!=='') {
143
+      $document=new DOMDocument();
144 144
       $document->load($path);
145 145
       return $document;
146 146
     } else {
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
   }
150 150
 
151 151
   private function getSourceXmlDocument() {
152
-    if(($content = $this->getDocumentContent()) !== '') {
153
-      $document = new DOMDocument();
152
+    if(($content=$this->getDocumentContent())!=='') {
153
+      $document=new DOMDocument();
154 154
       $document->loadXML($content);
155 155
       return $document;
156
-    } else if(($path = $this->getDocumentPath()) !== '') {
157
-      $document = new DOMDocument();
156
+    } else if(($path=$this->getDocumentPath())!=='') {
157
+      $document=new DOMDocument();
158 158
       $document->load($path);
159 159
       return $document;
160 160
     } else {
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
    * @param THtmlWriter The writer used for the rendering purpose
168 168
    */
169 169
   public function render($writer) {
170
-    if(($document=$this->getSourceXmlDocument()) === null) {
171
-	  $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
170
+    if(($document=$this->getSourceXmlDocument())===null) {
171
+	  $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
172 172
 	  parent::render($htmlWriter);
173
-      $document = new DOMDocument();
173
+      $document=new DOMDocument();
174 174
       $document->loadXML($htmlWriter->flush());
175 175
     }
176
-    $stylesheet = $this->getTransformXmlDocument();
176
+    $stylesheet=$this->getTransformXmlDocument();
177 177
 
178 178
     // Perform XSL transformation
179
-    $xslt = new XSLTProcessor();
179
+    $xslt=new XSLTProcessor();
180 180
     $xslt->importStyleSheet($stylesheet);
181 181
 
182 182
     // Check for parameters
183
-    $parameters = $this->getParameters();
183
+    $parameters=$this->getParameters();
184 184
     foreach($parameters as $name => $value) {
185 185
       $xslt->setParameter('', $name, $value);
186 186
     }
187
-    $output = $xslt->transformToXML($document);
187
+    $output=$xslt->transformToXML($document);
188 188
 
189 189
     // Write output
190 190
     $writer->write($output);
Please login to merge, or discard this patch.