Completed
Push — intl ( b391f2...20c33e )
by Fabio
08:04
created
framework/Web/UI/WebControls/TDatePicker.php 2 patches
Doc Comments   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,6 +110,7 @@  discard block
 block discarded – undo
110 110
 	/**
111 111
 	 * Sets the format of the date string.
112 112
 	 * @param string the format of the date string
113
+	 * @param string $value
113 114
 	 */
114 115
 	public function setDateFormat($value)
115 116
 	{
@@ -249,6 +250,7 @@  discard block
 block discarded – undo
249 250
 
250 251
 	/**
251 252
 	 * @param integer date picker starting year, default is 2000.
253
+	 * @param integer $value
252 254
 	 */
253 255
 	public function setFromYear($value)
254 256
 	{
@@ -358,6 +360,7 @@  discard block
 block discarded – undo
358 360
 
359 361
 	/**
360 362
 	 * @param string date string
363
+	 * @param string $value
361 364
 	 */
362 365
 	public function setDate($value)
363 366
 	{
@@ -481,7 +484,7 @@  discard block
 block discarded – undo
481 484
 	 * Loads date from drop down list data.
482 485
 	 * @param string the key that can be used to retrieve data from the input data collection
483 486
 	 * @param array the input data collection
484
-	 * @return array the date selected
487
+	 * @return string the date selected
485 488
 	 */
486 489
 	protected function getDateFromPostData($key, $values)
487 490
 	{
@@ -587,7 +590,7 @@  discard block
 block discarded – undo
587 590
 	}
588 591
 
589 592
 	/**
590
-	 * @return DateTimeFormatInfo date time format information for the current culture.
593
+	 * @return \Prado\I18N\core\DateTimeFormatInfo date time format information for the current culture.
591 594
 	 */
592 595
 	protected function getLocalizedCalendarInfo()
593 596
 	{
@@ -637,6 +640,7 @@  discard block
 block discarded – undo
637 640
 	 * Renders the calendar drop down list depending on the DateFormat pattern.
638 641
 	 * @param THtmlWriter the Html writer to render the drop down lists.
639 642
 	 * @param array the current selected date
643
+	 * @param \DateTime $date
640 644
 	 */
641 645
 	protected function renderCalendarSelections($writer, $date)
642 646
 	{
@@ -741,6 +745,7 @@  discard block
 block discarded – undo
741 745
 	 * "MMMM" will return the month names, "MM" or "MMM" return abbr. month names
742 746
 	 * and "M" return month digits.
743 747
 	 * @param DateTimeFormatInfo localized date format information.
748
+	 * @param \Prado\I18N\core\DateTimeFormatInfo $info
744 749
 	 * @return array localized month names.
745 750
 	 */
746 751
 	protected function getLocalizedMonthNames($info)
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	/**
85 85
 	 * Script path relative to the TClientScriptManager::SCRIPT_PATH
86 86
 	 */
87
-	const SCRIPT_PATH = 'datepicker';
87
+	const SCRIPT_PATH='datepicker';
88 88
 
89 89
 	/**
90 90
 	 * @var TDatePickerClientScript validator client-script options.
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function getDateFormat()
106 106
 	{
107
-		return $this->getViewState('DateFormat','dd-MM-yyyy');
107
+		return $this->getViewState('DateFormat', 'dd-MM-yyyy');
108 108
 	}
109 109
 
110 110
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function setDateFormat($value)
115 115
 	{
116
-		$this->setViewState('DateFormat',$value,'dd-MM-yyyy');
116
+		$this->setViewState('DateFormat', $value, 'dd-MM-yyyy');
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getShowCalendar()
123 123
 	{
124
-		return $this->getViewState('ShowCalendar',true);
124
+		return $this->getViewState('ShowCalendar', true);
125 125
 	}
126 126
 
127 127
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function setShowCalendar($value)
132 132
 	{
133
-		$this->setViewState('ShowCalendar',TPropertyValue::ensureBoolean($value),true);
133
+		$this->setViewState('ShowCalendar', TPropertyValue::ensureBoolean($value), true);
134 134
 	}
135 135
 
136 136
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function setFromYear($value)
254 254
 	{
255
-		$this->setViewState('FromYear', TPropertyValue::ensureInteger($value), intval(@date('Y'))-5);
255
+		$this->setViewState('FromYear', TPropertyValue::ensureInteger($value), intval(@date('Y')) - 5);
256 256
 	}
257 257
 
258 258
 	/**
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function getFromYear()
262 262
 	{
263
-		return $this->getViewState('FromYear', intval(@date('Y'))-5);
263
+		return $this->getViewState('FromYear', intval(@date('Y')) - 5);
264 264
 	}
265 265
 
266 266
 	/**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	public function setUpToYear($value)
270 270
 	{
271
-		$this->setViewState('UpToYear', TPropertyValue::ensureInteger($value), intval(@date('Y'))+10);
271
+		$this->setViewState('UpToYear', TPropertyValue::ensureInteger($value), intval(@date('Y')) + 10);
272 272
 	}
273 273
 
274 274
 	/**
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function getUpToYear()
278 278
 	{
279
-		return $this->getViewState('UpToYear', intval(@date('Y'))+10);
279
+		return $this->getViewState('UpToYear', intval(@date('Y')) + 10);
280 280
 	}
281 281
 
282 282
 	/**
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
 			$this->setText('');
317 317
 		else
318 318
 		{
319
-			$date = TPropertyValue::ensureFloat($value);
320
-			$formatter = new TSimpleDateFormatter($this->getDateFormat());
319
+			$date=TPropertyValue::ensureFloat($value);
320
+			$formatter=new TSimpleDateFormatter($this->getDateFormat());
321 321
 			$this->setText($formatter->format($date));
322 322
 		}
323 323
 	}
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	public function getClientSide()
378 378
 	{
379 379
 		if($this->_clientScript===null)
380
-			$this->_clientScript = $this->createClientScript();
380
+			$this->_clientScript=$this->createClientScript();
381 381
 		return $this->_clientScript;
382 382
 	}
383 383
 
@@ -396,10 +396,10 @@  discard block
 block discarded – undo
396 396
 	 */
397 397
 	public function getValidationPropertyValue()
398 398
 	{
399
-		if(($text = $this->getText()) === '')
399
+		if(($text=$this->getText())==='')
400 400
 			return '';
401
-		$date = $this->getTimeStamp();
402
-		return $date == null ? $text : $date;
401
+		$date=$this->getTimeStamp();
402
+		return $date==null ? $text : $date;
403 403
 	}
404 404
 
405 405
 	/**
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	 */
421 421
 	public function render($writer)
422 422
 	{
423
-		if($this->getInputMode() == TDatePickerInputMode::TextBox)
423
+		if($this->getInputMode()==TDatePickerInputMode::TextBox)
424 424
 		{
425 425
 			parent::render($writer);
426 426
 			$this->renderDatePickerButtons($writer);
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	{
444 444
 		if($this->getShowCalendar())
445 445
 		{
446
-			switch ($this->getMode())
446
+			switch($this->getMode())
447 447
 			{
448 448
 				case TDatePickerMode::Button:
449 449
 					$this->renderButtonDatePicker($writer);
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 	 * @param array the input data collection
464 464
 	 * @return boolean whether the data of the component has been changed
465 465
 	 */
466
-	public function loadPostData($key,$values)
466
+	public function loadPostData($key, $values)
467 467
 	{
468
-		if($this->getInputMode() == TDatePickerInputMode::TextBox)
468
+		if($this->getInputMode()==TDatePickerInputMode::TextBox)
469 469
 			return parent::loadPostData($key, $values);
470
-		$value = $this->getDateFromPostData($key, $values);
470
+		$value=$this->getDateFromPostData($key, $values);
471 471
 		if(!$this->getReadOnly() && $this->getText()!==$value)
472 472
 		{
473 473
 			$this->setText($value);
@@ -485,42 +485,42 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	protected function getDateFromPostData($key, $values)
487 487
 	{
488
-		$date = @getdate();
488
+		$date=@getdate();
489 489
 
490
-		$pattern = $this->getDateFormat();
491
-		$pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
492
-		$formatter = new TSimpleDateFormatter($pattern);
490
+		$pattern=$this->getDateFormat();
491
+		$pattern=str_replace(array('MMMM', 'MMM'), array('MM', 'MM'), $pattern);
492
+		$formatter=new TSimpleDateFormatter($pattern);
493 493
 
494
-		$order = $formatter->getDayMonthYearOrdering();
494
+		$order=$formatter->getDayMonthYearOrdering();
495 495
 
496 496
 		if(isset($values[$key.'$day'])) {
497
-			$day = intval($values[$key.'$day']);
497
+			$day=intval($values[$key.'$day']);
498 498
 		} elseif(in_array('day', $order)) {
499
-			$day = $date['mday'];
499
+			$day=$date['mday'];
500 500
 		} else {
501
-			$day = 1;
501
+			$day=1;
502 502
 		}
503 503
 
504 504
 		if(isset($values[$key.'$month']))
505
-			$month = intval($values[$key.'$month']) + 1;
505
+			$month=intval($values[$key.'$month']) + 1;
506 506
 		else
507
-			$month = $date['mon'];
507
+			$month=$date['mon'];
508 508
 
509 509
 		if(isset($values[$key.'$year']))
510
-			$year = intval($values[$key.'$year']);
510
+			$year=intval($values[$key.'$year']);
511 511
 		else
512
-			$year = $date['year'];
512
+			$year=$date['year'];
513 513
 
514
-		$s = new \DateTime;
514
+		$s=new \DateTime;
515 515
 		$s->setDate($year, $month, $day);
516
-		$s->setTime(0, 0 , 0);
517
-		$date = $s->getTimeStamp();
516
+		$s->setTime(0, 0, 0);
517
+		$date=$s->getTimeStamp();
518 518
 		//$date = @mktime(0, 0, 0, $month, $day, $year);
519 519
 
520
-		$pattern = $this->getDateFormat();
521
-		$pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
520
+		$pattern=$this->getDateFormat();
521
+		$pattern=str_replace(array('MMMM', 'MMM'), array('MM', 'MM'), $pattern);
522 522
 
523
-		$formatter = new TSimpleDateFormatter($pattern);
523
+		$formatter=new TSimpleDateFormatter($pattern);
524 524
 		return $formatter->format($date);
525 525
 	}
526 526
 
@@ -530,31 +530,31 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	protected function getDatePickerOptions()
532 532
 	{
533
-		$options['ID'] = $this->getClientID();
534
-		$options['InputMode'] = $this->getInputMode();
535
-		$options['Format'] = $this->getDateFormat();
536
-		$options['FirstDayOfWeek'] = $this->getFirstDayOfWeek();
533
+		$options['ID']=$this->getClientID();
534
+		$options['InputMode']=$this->getInputMode();
535
+		$options['Format']=$this->getDateFormat();
536
+		$options['FirstDayOfWeek']=$this->getFirstDayOfWeek();
537 537
 		if(($cssClass=$this->getCssClass())!=='')
538
-			$options['ClassName'] = $cssClass;
539
-		$options['CalendarStyle'] = $this->getCalendarStyle();
540
-		$options['FromYear'] = $this->getFromYear();
541
-		$options['UpToYear'] = $this->getUpToYear();
538
+			$options['ClassName']=$cssClass;
539
+		$options['CalendarStyle']=$this->getCalendarStyle();
540
+		$options['FromYear']=$this->getFromYear();
541
+		$options['UpToYear']=$this->getUpToYear();
542 542
 		switch($this->getMode())
543 543
 		{
544 544
 			case TDatePickerMode::Basic:
545 545
 				break;
546 546
 			case TDatePickerMode::Clickable:
547
-				$options['TriggerEvent'] = "click";
547
+				$options['TriggerEvent']="click";
548 548
 				break;
549 549
 			default:
550
-				$options['Trigger'] = $this->getDatePickerButtonID();
550
+				$options['Trigger']=$this->getDatePickerButtonID();
551 551
 				break;
552 552
 		}
553
-		$options['PositionMode'] = $this->getPositionMode();
553
+		$options['PositionMode']=$this->getPositionMode();
554 554
 
555
-		$options = array_merge($options, $this->getCulturalOptions());
555
+		$options=array_merge($options, $this->getCulturalOptions());
556 556
 		if($this->_clientScript!==null)
557
-			$options = array_merge($options,
557
+			$options=array_merge($options,
558 558
 				$this->_clientScript->getOptions()->toArray());
559 559
 		return $options;
560 560
 	}
@@ -565,13 +565,13 @@  discard block
 block discarded – undo
565 565
 	 */
566 566
 	protected function getCulturalOptions()
567 567
 	{
568
-		if($this->getCurrentCulture() == 'en')
568
+		if($this->getCurrentCulture()=='en')
569 569
 			return array();
570 570
 
571
-		$date = $this->getLocalizedCalendarInfo();
572
-		$options['MonthNames'] = $date->getMonthNames();
573
-		$options['AbbreviatedMonthNames'] = $date->getAbbreviatedMonthNames();
574
-		$options['ShortWeekDayNames'] = $date->getAbbreviatedDayNames();
571
+		$date=$this->getLocalizedCalendarInfo();
572
+		$options['MonthNames']=$date->getMonthNames();
573
+		$options['AbbreviatedMonthNames']=$date->getAbbreviatedMonthNames();
574
+		$options['ShortWeekDayNames']=$date->getAbbreviatedDayNames();
575 575
 
576 576
 		return $options;
577 577
 	}
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 	 */
582 582
 	protected function getCurrentCulture()
583 583
 	{
584
-		$app = $this->getApplication()->getGlobalization(false);
585
-		return $this->getCulture() == '' ?
584
+		$app=$this->getApplication()->getGlobalization(false);
585
+		return $this->getCulture()=='' ?
586 586
 				($app ? $app->getCulture() : 'en') : $this->getCulture();
587 587
 	}
588 588
 
@@ -592,8 +592,8 @@  discard block
 block discarded – undo
592 592
 	protected function getLocalizedCalendarInfo()
593 593
 	{
594 594
 		//expensive operations
595
-		$culture = $this->getCurrentCulture();
596
-		$info = new CultureInfo($culture);
595
+		$culture=$this->getCurrentCulture();
596
+		$info=new CultureInfo($culture);
597 597
 		return $info->getDateTimeFormat();
598 598
 	}
599 599
 
@@ -602,18 +602,18 @@  discard block
 block discarded – undo
602 602
 	 */
603 603
 	protected function renderDropDownListCalendar($writer)
604 604
 	{
605
-		if($this->getMode() == TDatePickerMode::Basic)
605
+		if($this->getMode()==TDatePickerMode::Basic)
606 606
 			$this->setMode(TDatePickerMode::ImageButton);
607 607
 		parent::addAttributesToRender($writer);
608 608
 		$writer->removeAttribute('name');
609 609
 		$writer->removeAttribute('type');
610 610
 		$writer->addAttribute('id', $this->getClientID());
611 611
 
612
-		if(strlen($class = $this->getCssClass()) > 0)
612
+		if(strlen($class=$this->getCssClass()) > 0)
613 613
 			$writer->addAttribute('class', $class);
614 614
 		$writer->renderBeginTag('span');
615 615
 
616
-		$date = new \DateTime;
616
+		$date=new \DateTime;
617 617
 		$date->setTimeStamp($this->getTimeStampFromText());
618 618
 		$this->renderCalendarSelections($writer, $date);
619 619
 
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 
630 630
 	protected function hasDayPattern()
631 631
 	{
632
-		$formatter = new TSimpleDateFormatter($this->getDateFormat());
632
+		$formatter=new TSimpleDateFormatter($this->getDateFormat());
633 633
 		return ($formatter->getDayPattern()!==null);
634 634
 	}
635 635
 
@@ -640,15 +640,15 @@  discard block
 block discarded – undo
640 640
 	 */
641 641
 	protected function renderCalendarSelections($writer, $date)
642 642
 	{
643
-		$formatter = new TSimpleDateFormatter($this->getDateFormat());
643
+		$formatter=new TSimpleDateFormatter($this->getDateFormat());
644 644
 
645 645
 		foreach($formatter->getDayMonthYearOrdering() as $type)
646 646
 		{
647
-			if($type == 'day')
647
+			if($type=='day')
648 648
 				$this->renderCalendarDayOptions($writer, $date->format('j'));
649
-			elseif($type == 'month')
649
+			elseif($type=='month')
650 650
 				$this->renderCalendarMonthOptions($writer, $date->format('n'));
651
-			elseif($type == 'year')
651
+			elseif($type=='year')
652 652
 				$this->renderCalendarYearOptions($writer, $date->format('Y'));
653 653
 		}
654 654
 	}
@@ -659,9 +659,9 @@  discard block
 block discarded – undo
659 659
 	 */
660 660
 	protected function getTimeStampFromText()
661 661
 	{
662
-		$pattern = $this->getDateFormat();
663
-		$pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
664
-		$formatter = new TSimpleDateFormatter($pattern);
662
+		$pattern=$this->getDateFormat();
663
+		$pattern=str_replace(array('MMMM', 'MMM'), array('MM', 'MM'), $pattern);
664
+		$formatter=new TSimpleDateFormatter($pattern);
665 665
 		return $formatter->parse($this->getText());
666 666
 	}
667 667
 
@@ -671,12 +671,12 @@  discard block
 block discarded – undo
671 671
 	 * @param array list of selection options
672 672
 	 * @param mixed selected key.
673 673
 	 */
674
-	private function renderDropDownListOptions($writer,$options,$selected=null)
674
+	private function renderDropDownListOptions($writer, $options, $selected=null)
675 675
 	{
676 676
 		foreach($options as $k => $v)
677 677
 		{
678 678
 			$writer->addAttribute('value', $k);
679
-			if($k == $selected)
679
+			if($k==$selected)
680 680
 				$writer->addAttribute('selected', 'selected');
681 681
 			$writer->renderBeginTag('option');
682 682
 			$writer->write($v);
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 */
692 692
 	protected function renderCalendarDayOptions($writer, $selected=null)
693 693
 	{
694
-		$days = $this->getDropDownDayOptions();
694
+		$days=$this->getDropDownDayOptions();
695 695
 		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'day');
696 696
 		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'day');
697 697
 		$writer->addAttribute('class', 'datepicker_day_options');
@@ -707,12 +707,12 @@  discard block
 block discarded – undo
707 707
 	 */
708 708
 	protected function getDropDownDayOptions()
709 709
 	{
710
-		$formatter = new TSimpleDateFormatter($this->getDateFormat());
711
-		$days = array();
712
-		$requiresPadding = $formatter->getDayPattern() === 'dd';
713
-		for($i=1;$i<=31;$i++)
710
+		$formatter=new TSimpleDateFormatter($this->getDateFormat());
711
+		$days=array();
712
+		$requiresPadding=$formatter->getDayPattern()==='dd';
713
+		for($i=1; $i <= 31; $i++)
714 714
 		{
715
-			$days[$i] = $requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i;
715
+			$days[$i]=$requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i;
716 716
 		}
717 717
 		return $days;
718 718
 	}
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 	 */
725 725
 	protected function renderCalendarMonthOptions($writer, $selected=null)
726 726
 	{
727
-		$info = $this->getLocalizedCalendarInfo();
727
+		$info=$this->getLocalizedCalendarInfo();
728 728
 		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'month');
729 729
 		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'month');
730 730
 		$writer->addAttribute('class', 'datepicker_month_options');
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 			$writer->addAttribute('disabled', 'disabled');
733 733
 		$writer->renderBeginTag('select');
734 734
 		$this->renderDropDownListOptions($writer,
735
-					$this->getLocalizedMonthNames($info), $selected-1);
735
+					$this->getLocalizedMonthNames($info), $selected - 1);
736 736
 		$writer->renderEndTag();
737 737
 	}
738 738
 
@@ -745,17 +745,17 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	protected function getLocalizedMonthNames($info)
747 747
 	{
748
-		$formatter = new TSimpleDateFormatter($this->getDateFormat());
748
+		$formatter=new TSimpleDateFormatter($this->getDateFormat());
749 749
 		switch($formatter->getMonthPattern())
750 750
 		{
751 751
 			case 'MMM': return $info->getAbbreviatedMonthNames();
752 752
 			case 'MM':
753
-				$array = array();
754
-				for($i=1;$i<=12;$i++)
755
-						$array[$i-1] = $i < 10 ? '0'.$i : $i;
753
+				$array=array();
754
+				for($i=1; $i <= 12; $i++)
755
+						$array[$i - 1]=$i < 10 ? '0'.$i : $i;
756 756
 				return $array;
757 757
 			case 'M':
758
-				$array = array(); for($i=1;$i<=12;$i++) $array[$i-1] = $i;
758
+				$array=array(); for($i=1; $i <= 12; $i++) $array[$i - 1]=$i;
759 759
 				return $array;
760 760
 			default :	return $info->getMonthNames();
761 761
 		}
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 	 */
769 769
 	protected function renderCalendarYearOptions($writer, $selected=null)
770 770
 	{
771
-		$years = array();
772
-		for($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++)
773
-			$years[$i] = $i;
771
+		$years=array();
772
+		for($i=$this->getFromYear(); $i <= $this->getUpToYear(); $i++)
773
+			$years[$i]=$i;
774 774
 		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'year');
775 775
 		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'year');
776 776
 		$writer->addAttribute('class', 'datepicker_year_options');
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 		$writer->addAttribute('id', $this->getDatePickerButtonID());
800 800
 		$writer->addAttribute('type', 'button');
801 801
 		$writer->addAttribute('class', $this->getCssClass().' TDatePickerButton');
802
-		$writer->addAttribute('value',$this->getButtonText());
802
+		$writer->addAttribute('value', $this->getButtonText());
803 803
 		if(!$this->getEnabled(true))
804 804
 			$writer->addAttribute('disabled', 'disabled');
805 805
 		$writer->renderBeginTag("input");
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 	 */
813 813
 	 protected function renderImageButtonDatePicker($writer)
814 814
 	{
815
-		$url = $this->getButtonImageUrl();
816
-		$url = empty($url) ? $this->getAssetUrl('calendar.png') : $url;
815
+		$url=$this->getButtonImageUrl();
816
+		$url=empty($url) ? $this->getAssetUrl('calendar.png') : $url;
817 817
 		$writer->addAttribute('id', $this->getDatePickerButtonID());
818 818
 		$writer->addAttribute('src', $url);
819 819
 		$writer->addAttribute('alt', ' ');
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 	 */
833 833
 	protected function getAssetUrl($file='')
834 834
 	{
835
-		$base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
835
+		$base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl();
836 836
 		return $base.'/'.self::SCRIPT_PATH.'/'.$file;
837 837
 	}
838 838
 
@@ -842,8 +842,8 @@  discard block
 block discarded – undo
842 842
 	 */
843 843
 	protected function publishCalendarStyle()
844 844
 	{
845
-		$url = $this->getAssetUrl($this->getCalendarStyle().'.css');
846
-		$cs = $this->getPage()->getClientScript();
845
+		$url=$this->getAssetUrl($this->getCalendarStyle().'.css');
846
+		$cs=$this->getPage()->getClientScript();
847 847
 		if(!$cs->isStyleSheetFileRegistered($url))
848 848
 			$cs->registerStyleSheetFile($url, $url);
849 849
 		return $url;
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 	protected function addAttributesToRender($writer)
857 857
 	{
858 858
 		parent::addAttributesToRender($writer);
859
-		$writer->addAttribute('id',$this->getClientID());
859
+		$writer->addAttribute('id', $this->getClientID());
860 860
 	}
861 861
 
862 862
 	/**
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 	{
867 867
 		if($this->getShowCalendar())
868 868
 		{
869
-			$cs = $this->getPage()->getClientScript();
869
+			$cs=$this->getPage()->getClientScript();
870 870
 			$cs->registerPradoScript("datepicker");
871 871
 		}
872 872
 	}
@@ -875,16 +875,16 @@  discard block
 block discarded – undo
875 875
 	{
876 876
 		if($this->getShowCalendar())
877 877
 		{
878
-			$cs = $this->getPage()->getClientScript();
878
+			$cs=$this->getPage()->getClientScript();
879 879
 			if(!$cs->isEndScriptRegistered('TDatePicker.spacer'))
880 880
 			{
881
-				$spacer = $this->getAssetUrl('spacer.gif');
882
-				$code = "Prado.WebUI.TDatePicker.spacer = '$spacer';";
881
+				$spacer=$this->getAssetUrl('spacer.gif');
882
+				$code="Prado.WebUI.TDatePicker.spacer = '$spacer';";
883 883
 				$cs->registerEndScript('TDatePicker.spacer', $code);
884 884
 			}
885 885
 
886
-			$options = TJavaScript::encode($this->getDatePickerOptions());
887
-			$code = "new Prado.WebUI.TDatePicker($options);";
886
+			$options=TJavaScript::encode($this->getDatePickerOptions());
887
+			$code="new Prado.WebUI.TDatePicker($options);";
888 888
 			$cs->registerEndScript("prado:".$this->getClientID(), $code);
889 889
 		}
890 890
 	}
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TSqliteScaffoldInput.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 			case 'datetime': case 'timestamp':
37 37
 				return $this->createDateTimeControl($container, $column, $record);
38 38
 			default:
39
-				return $this->createDefaultControl($container,$column, $record);
39
+				return $this->createDefaultControl($container, $column, $record);
40 40
 		}
41 41
 	}
42 42
 
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
 			case 'time':
54 54
 				return $this->getTimeValue($container, $column, $record);
55 55
 			case 'datetime': case 'timestamp':
56
-				return $this->getDateTimeValue($container,$column, $record);
56
+				return $this->getDateTimeValue($container, $column, $record);
57 57
 			default:
58
-				return $this->getDefaultControlValue($container,$column, $record);
58
+				return $this->getDefaultControlValue($container, $column, $record);
59 59
 		}
60 60
 	}
61 61
 
62 62
 	protected function createDateControl($container, $column, $record)
63 63
 	{
64
-		$control = parent::createDateControl($container, $column, $record);
65
-		$value = $this->getRecordPropertyValue($column, $record);
64
+		$control=parent::createDateControl($container, $column, $record);
65
+		$value=$this->getRecordPropertyValue($column, $record);
66 66
 		if(!empty($value) && preg_match('/timestamp/i', $column->getDbType()))
67 67
 			$control->setTimestamp(intval($value));
68 68
 		return $control;
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 
71 71
 	protected function createDateTimeControl($container, $column, $record)
72 72
 	{
73
-		$value = $this->getRecordPropertyValue($column, $record);
74
-		$time = parent::createDateTimeControl($container, $column, $record);
73
+		$value=$this->getRecordPropertyValue($column, $record);
74
+		$time=parent::createDateTimeControl($container, $column, $record);
75 75
 		if(!empty($value) && preg_match('/timestamp/i', $column->getDbType()))
76 76
 		{
77
-			$dt = new \DateTime;
77
+			$dt=new \DateTime;
78 78
 			$dt->setTimestamp(intval($value));
79 79
 			$time[1]->setSelectedValue($dt->format('G'));
80 80
 			$time[2]->setSelectedValue($dt->format('i'));
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 	{
88 88
 		if(preg_match('/timestamp/i', $column->getDbType()))
89 89
 		{
90
-			$time = $container->findControl(self::DEFAULT_ID)->getTimestamp();
91
-			$dt = new \DateTime;
90
+			$time=$container->findControl(self::DEFAULT_ID)->getTimestamp();
91
+			$dt=new \DateTime;
92 92
 			$dt->setTimestamp($time);
93
-			$hour = $container->findControl('scaffold_time_hour')->getSelectedValue();
94
-			$mins = $container->findControl('scaffold_time_min')->getSelectedValue();
95
-			$secs = $container->findControl('scaffold_time_sec')->getSelectedValue();
93
+			$hour=$container->findControl('scaffold_time_hour')->getSelectedValue();
94
+			$mins=$container->findControl('scaffold_time_min')->getSelectedValue();
95
+			$secs=$container->findControl('scaffold_time_sec')->getSelectedValue();
96 96
 			return $s->getTimeStamp(
97 97
 				$hour,
98 98
 				$mins,
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@
 block discarded – undo
101 101
 				$dt->format('j'),
102 102
 				$dt->format('Y')
103 103
 			);
104
-		}
105
-		else
104
+		} else
106 105
 			return parent::getDateTimeValue($container, $column, $record);
107 106
 	}
108 107
 }
Please login to merge, or discard this patch.
framework/Collections/TPriorityList.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param integer the precision of the numeric priorities
88 88
 	 * @throws TInvalidDataTypeException If data is not null and is neither an array nor an iterator.
89 89
 	 */
90
-	public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8)
90
+	public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8)
91 91
 	{
92 92
 		parent::__construct();
93 93
 		if($data!==null)
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	{
126 126
 		if($priority===null)
127 127
 			$priority=$this->getDefaultPriority();
128
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
128
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
129 129
 
130 130
 		if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority]))
131 131
 			return false;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	protected function setDefaultPriority($value)
148 148
 	{
149
-		$this->_dp=(string)round(TPropertyValue::ensureFloat($value),$this->_p);
149
+		$this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p);
150 150
 	}
151 151
 
152 152
 	/**
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	protected function sortPriorities() {
194 194
 		if(!$this->_o) {
195
-			ksort($this->_d,SORT_NUMERIC);
195
+			ksort($this->_d, SORT_NUMERIC);
196 196
 			$this->_o=true;
197 197
 		}
198 198
 	}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$this->sortPriorities();
209 209
 		$this->_fd=array();
210 210
 		foreach($this->_d as $priority => $itemsatpriority)
211
-			$this->_fd=array_merge($this->_fd,$itemsatpriority);
211
+			$this->_fd=array_merge($this->_fd, $itemsatpriority);
212 212
 		return $this->_fd;
213 213
 	}
214 214
 
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public function itemAt($index)
224 224
 	{
225
-		if($index>=0&&$index<$this->getCount()) {
225
+		if($index >= 0 && $index < $this->getCount()) {
226 226
 			$arr=$this->flattenPriorities();
227 227
 			return $arr[$index];
228 228
 		} else
229
-			throw new TInvalidDataValueException('list_index_invalid',$index);
229
+			throw new TInvalidDataValueException('list_index_invalid', $index);
230 230
 	}
231 231
 
232 232
 	/**
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 	{
239 239
 		if($priority===null)
240 240
 			$priority=$this->getDefaultPriority();
241
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
241
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
242 242
 
243
-		return isset($this->_d[$priority])?$this->_d[$priority]:null;
243
+		return isset($this->_d[$priority]) ? $this->_d[$priority] : null;
244 244
 	}
245 245
 
246 246
 	/**
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
 	 * @param numeric the priority which to index.  no parameter or null will result in the default priority
250 250
 	 * @return mixed the element at the offset, false if no element is found at the offset
251 251
 	 */
252
-	public function itemAtIndexInPriority($index,$priority=null)
252
+	public function itemAtIndexInPriority($index, $priority=null)
253 253
 	{
254 254
 		if($priority===null)
255 255
 			$priority=$this->getDefaultPriority();
256
-		$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
256
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
257 257
 
258
-		return !isset($this->_d[$priority])?false:(
259
-				isset($this->_d[$priority][$index])?$this->_d[$priority][$index]:false
258
+		return !isset($this->_d[$priority]) ?false:(
259
+				isset($this->_d[$priority][$index]) ? $this->_d[$priority][$index] : false
260 260
 			);
261 261
 	}
262 262
 
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	 * @return int the index within the flattened array
269 269
 	 * @throws TInvalidOperationException if the map is read-only
270 270
 	 */
271
-	public function add($item,$priority=null)
271
+	public function add($item, $priority=null)
272 272
 	{
273 273
 		if($this->getReadOnly())
274
-			throw new TInvalidOperationException('list_readonly',get_class($this));
274
+			throw new TInvalidOperationException('list_readonly', get_class($this));
275 275
 
276
-		return $this->insertAtIndexInPriority($item,false,$priority,true);
276
+		return $this->insertAtIndexInPriority($item, false, $priority, true);
277 277
 	}
278 278
 
279 279
 	/**
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
 	 * @throws TInvalidDataValueException If the index specified exceeds the bound
285 285
 	 * @throws TInvalidOperationException if the list is read-only
286 286
 	 */
287
-	public function insertAt($index,$item)
287
+	public function insertAt($index, $item)
288 288
 	{
289 289
 		if($this->getReadOnly())
290
-			throw new TInvalidOperationException('list_readonly',get_class($this));
290
+			throw new TInvalidOperationException('list_readonly', get_class($this));
291 291
 
292
-		if(($priority=$this->priorityAt($index,true))!==false)
293
-			$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
292
+		if(($priority=$this->priorityAt($index, true))!==false)
293
+			$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
294 294
 		else
295
-			throw new TInvalidDataValueException('list_index_invalid',$index);
295
+			throw new TInvalidDataValueException('list_index_invalid', $index);
296 296
 	}
297 297
 
298 298
 	/**
@@ -305,54 +305,54 @@  discard block
 block discarded – undo
305 305
 	 * @throws TInvalidDataValueException If the index specified exceeds the bound
306 306
 	 * @throws TInvalidOperationException if the list is read-only
307 307
 	 */
308
-	public function insertAtIndexInPriority($item,$index=false,$priority=null,$preserveCache=false)
308
+	public function insertAtIndexInPriority($item, $index=false, $priority=null, $preserveCache=false)
309 309
 	{
310 310
 		if($this->getReadOnly())
311
-			throw new TInvalidOperationException('list_readonly',get_class($this));
311
+			throw new TInvalidOperationException('list_readonly', get_class($this));
312 312
 
313 313
 		if($priority===null)
314 314
 			$priority=$this->getDefaultPriority();
315
-		$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
315
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
316 316
 
317 317
 		if($preserveCache) {
318 318
 			$this->sortPriorities();
319 319
 			$cc=0;
320 320
 			foreach($this->_d as $prioritykey=>$items)
321
-				if($prioritykey>=$priority)
321
+				if($prioritykey >= $priority)
322 322
 					break;
323 323
 				else
324 324
 					$cc+=count($items);
325 325
 
326
-			if($index===false&&isset($this->_d[$priority])) {
326
+			if($index===false && isset($this->_d[$priority])) {
327 327
 				$c=count($this->_d[$priority]);
328 328
 				$c+=$cc;
329 329
 				$this->_d[$priority][]=$item;
330 330
 			} else if(isset($this->_d[$priority])) {
331
-				$c=$index+$cc;
332
-				array_splice($this->_d[$priority],$index,0,array($item));
331
+				$c=$index + $cc;
332
+				array_splice($this->_d[$priority], $index, 0, array($item));
333 333
 			} else {
334
-				$c = $cc;
335
-				$this->_o = false;
334
+				$c=$cc;
335
+				$this->_o=false;
336 336
 				$this->_d[$priority]=array($item);
337 337
 			}
338 338
 
339
-			if($this->_fd&&is_array($this->_fd)) // if there is a flattened array cache
340
-				array_splice($this->_fd,$c,0,array($item));
339
+			if($this->_fd && is_array($this->_fd)) // if there is a flattened array cache
340
+				array_splice($this->_fd, $c, 0, array($item));
341 341
 		} else {
342 342
 			$c=null;
343
-			if($index===false&&isset($this->_d[$priority])) {
343
+			if($index===false && isset($this->_d[$priority])) {
344 344
 				$cc=count($this->_d[$priority]);
345 345
 				$this->_d[$priority][]=$item;
346 346
 			} else if(isset($this->_d[$priority])) {
347 347
 				$cc=$index;
348
-				array_splice($this->_d[$priority],$index,0,array($item));
348
+				array_splice($this->_d[$priority], $index, 0, array($item));
349 349
 			} else {
350 350
 				$cc=0;
351 351
 				$this->_o=false;
352 352
 				$this->_d[$priority]=array($item);
353 353
 			}
354
-			if($this->_fd&&is_array($this->_fd)&&count($this->_d)==1)
355
-				array_splice($this->_fd,$cc,0,array($item));
354
+			if($this->_fd && is_array($this->_fd) && count($this->_d)==1)
355
+				array_splice($this->_fd, $cc, 0, array($item));
356 356
 			else
357 357
 				$this->_fd=null;
358 358
 		}
@@ -373,22 +373,22 @@  discard block
 block discarded – undo
373 373
 	 * @return integer index within the flattened list at which the item is being removed
374 374
 	 * @throws TInvalidDataValueException If the item does not exist
375 375
 	 */
376
-	public function remove($item,$priority=false)
376
+	public function remove($item, $priority=false)
377 377
 	{
378 378
 		if($this->getReadOnly())
379
-			throw new TInvalidOperationException('list_readonly',get_class($this));
379
+			throw new TInvalidOperationException('list_readonly', get_class($this));
380 380
 
381
-		if(($p=$this->priorityOf($item,true))!==false)
381
+		if(($p=$this->priorityOf($item, true))!==false)
382 382
 		{
383 383
 			if($priority!==false) {
384 384
 				if($priority===null)
385 385
 					$priority=$this->getDefaultPriority();
386
-				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
386
+				$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
387 387
 
388 388
 				if($p[0]!=$priority)
389 389
 					throw new TInvalidDataValueException('list_item_inexistent');
390 390
 			}
391
-			$this->removeAtIndexInPriority($p[1],$p[0]);
391
+			$this->removeAtIndexInPriority($p[1], $p[0]);
392 392
 			return $p[2];
393 393
 		}
394 394
 		else
@@ -405,11 +405,11 @@  discard block
 block discarded – undo
405 405
 	public function removeAt($index)
406 406
 	{
407 407
 		if($this->getReadOnly())
408
-			throw new TInvalidOperationException('list_readonly',get_class($this));
408
+			throw new TInvalidOperationException('list_readonly', get_class($this));
409 409
 
410 410
 		if(($priority=$this->priorityAt($index, true))!==false)
411
-			return $this->removeAtIndexInPriority($priority[1],$priority[0]);
412
-		throw new TInvalidDataValueException('list_index_invalid',$index);
411
+			return $this->removeAtIndexInPriority($priority[1], $priority[0]);
412
+		throw new TInvalidDataValueException('list_index_invalid', $index);
413 413
 	}
414 414
 
415 415
 	/**
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 	public function removeAtIndexInPriority($index, $priority=null)
424 424
 	{
425 425
 		if($this->getReadOnly())
426
-			throw new TInvalidOperationException('list_readonly',get_class($this));
426
+			throw new TInvalidOperationException('list_readonly', get_class($this));
427 427
 
428 428
 		if($priority===null)
429 429
 			$priority=$this->getDefaultPriority();
430
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
430
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
431 431
 
432
-		if(!isset($this->_d[$priority])||$index<0||$index>=count($this->_d[$priority]))
432
+		if(!isset($this->_d[$priority]) || $index < 0 || $index >= count($this->_d[$priority]))
433 433
 			throw new TInvalidDataValueException('list_item_inexistent');
434 434
 
435 435
 		// $value is an array of elements removed, only one
436
-		$value=array_splice($this->_d[$priority],$index,1);
436
+		$value=array_splice($this->_d[$priority], $index, 1);
437 437
 		$value=$value[0];
438 438
 
439 439
 		if(!count($this->_d[$priority]))
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 	public function clear()
451 451
 	{
452 452
 		if($this->getReadOnly())
453
-			throw new TInvalidOperationException('list_readonly',get_class($this));
453
+			throw new TInvalidOperationException('list_readonly', get_class($this));
454 454
 
455 455
 		foreach($this->_d as $priority=>$items) {
456
-			for($index=count($items)-1;$index>=0;$index--)
457
-				$this->removeAtIndexInPriority($index,$priority);
456
+			for($index=count($items) - 1; $index >= 0; $index--)
457
+				$this->removeAtIndexInPriority($index, $priority);
458 458
 			unset($this->_d[$priority]);
459 459
 		}
460 460
 	}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 */
466 466
 	public function contains($item)
467 467
 	{
468
-		return $this->indexOf($item)>=0;
468
+		return $this->indexOf($item) >= 0;
469 469
 	}
470 470
 
471 471
 	/**
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	public function indexOf($item)
476 476
 	{
477
-		if(($index=array_search($item,$this->flattenPriorities(),true))===false)
477
+		if(($index=array_search($item, $this->flattenPriorities(), true))===false)
478 478
 			return -1;
479 479
 		else
480 480
 			return $index;
@@ -489,16 +489,16 @@  discard block
 block discarded – undo
489 489
 	 *   if withindex is true, an array is returned of [0 => $priority, 1 => $priorityIndex, 2 => flattenedIndex,
490 490
 	 * 'priority' => $priority, 'index' => $priorityIndex, 'absindex' => flattenedIndex]
491 491
 	 */
492
-	public function priorityOf($item,$withindex = false)
492
+	public function priorityOf($item, $withindex=false)
493 493
 	{
494 494
 		$this->sortPriorities();
495 495
 
496
-		$absindex = 0;
496
+		$absindex=0;
497 497
 		foreach($this->_d as $priority=>$items) {
498
-			if(($index=array_search($item,$items,true))!==false) {
498
+			if(($index=array_search($item, $items, true))!==false) {
499 499
 				$absindex+=$index;
500
-				return $withindex?array($priority,$index,$absindex,
501
-						'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
500
+				return $withindex ? array($priority, $index, $absindex,
501
+						'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority;
502 502
 			} else
503 503
 				$absindex+=count($items);
504 504
 		}
@@ -515,19 +515,19 @@  discard block
 block discarded – undo
515 515
 	 *   if withindex is true, an array is returned of [0 => $priority, 1 => $priorityIndex, 2 => flattenedIndex,
516 516
 	 * 'priority' => $priority, 'index' => $priorityIndex, 'absindex' => flattenedIndex]
517 517
 	 */
518
-	public function priorityAt($index,$withindex = false)
518
+	public function priorityAt($index, $withindex=false)
519 519
 	{
520
-		if($index<0||$index>=$this->getCount())
521
-			throw new TInvalidDataValueException('list_index_invalid',$index);
520
+		if($index < 0 || $index >= $this->getCount())
521
+			throw new TInvalidDataValueException('list_index_invalid', $index);
522 522
 
523 523
 		$absindex=$index;
524 524
 		$this->sortPriorities();
525 525
 		foreach($this->_d as $priority=>$items) {
526
-			if($index>=($c=count($items)))
526
+			if($index >= ($c=count($items)))
527 527
 				$index-=$c;
528 528
 			else
529
-				return $withindex?array($priority,$index,$absindex,
530
-						'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
529
+				return $withindex ? array($priority, $index, $absindex,
530
+						'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority;
531 531
 		}
532 532
 		return false;
533 533
 	}
@@ -543,12 +543,12 @@  discard block
 block discarded – undo
543 543
 	public function insertBefore($indexitem, $item)
544 544
 	{
545 545
 		if($this->getReadOnly())
546
-			throw new TInvalidOperationException('list_readonly',get_class($this));
546
+			throw new TInvalidOperationException('list_readonly', get_class($this));
547 547
 
548
-		if(($priority=$this->priorityOf($indexitem,true))===false)
548
+		if(($priority=$this->priorityOf($indexitem, true))===false)
549 549
 			throw new TInvalidDataValueException('list_item_inexistent');
550 550
 
551
-		$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
551
+		$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
552 552
 
553 553
 		return $priority[2];
554 554
 	}
@@ -564,14 +564,14 @@  discard block
 block discarded – undo
564 564
 	public function insertAfter($indexitem, $item)
565 565
 	{
566 566
 		if($this->getReadOnly())
567
-			throw new TInvalidOperationException('list_readonly',get_class($this));
567
+			throw new TInvalidOperationException('list_readonly', get_class($this));
568 568
 
569
-		if(($priority=$this->priorityOf($indexitem,true))===false)
569
+		if(($priority=$this->priorityOf($indexitem, true))===false)
570 570
 			throw new TInvalidDataValueException('list_item_inexistent');
571 571
 
572
-		$this->insertAtIndexInPriority($item,$priority[1]+1,$priority[0]);
572
+		$this->insertAtIndexInPriority($item, $priority[1] + 1, $priority[0]);
573 573
 
574
-		return $priority[2]+1;
574
+		return $priority[2] + 1;
575 575
 	}
576 576
 
577 577
 	/**
@@ -598,15 +598,15 @@  discard block
 block discarded – undo
598 598
 	 * @return array the array of priorities keys with values of arrays of items that are below a specified priority.
599 599
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
600 600
 	 */
601
-	public function toArrayBelowPriority($priority,$inclusive=false)
601
+	public function toArrayBelowPriority($priority, $inclusive=false)
602 602
 	{
603 603
 		$this->sortPriorities();
604 604
 		$items=array();
605 605
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
606 606
 		{
607
-			if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority)
607
+			if((!$inclusive && $itemspriority >= $priority) || $itemspriority > $priority)
608 608
 				break;
609
-			$items=array_merge($items,$itemsatpriority);
609
+			$items=array_merge($items, $itemsatpriority);
610 610
 		}
611 611
 		return $items;
612 612
 	}
@@ -618,15 +618,15 @@  discard block
 block discarded – undo
618 618
 	 * @return array the array of priorities keys with values of arrays of items that are above a specified priority.
619 619
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
620 620
 	 */
621
-	public function toArrayAbovePriority($priority,$inclusive=true)
621
+	public function toArrayAbovePriority($priority, $inclusive=true)
622 622
 	{
623 623
 		$this->sortPriorities();
624 624
 		$items=array();
625 625
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
626 626
 		{
627
-			if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority)
627
+			if((!$inclusive && $itemspriority <= $priority) || $itemspriority < $priority)
628 628
 				continue;
629
-			$items=array_merge($items,$itemsatpriority);
629
+			$items=array_merge($items, $itemsatpriority);
630 630
 		}
631 631
 		return $items;
632 632
 	}
@@ -642,15 +642,15 @@  discard block
 block discarded – undo
642 642
 	{
643 643
 		if($data instanceof TPriorityList)
644 644
 		{
645
-			if($this->getCount()>0)
645
+			if($this->getCount() > 0)
646 646
 				$this->clear();
647 647
 			foreach($data->getPriorities() as $priority)
648 648
 			{
649 649
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
650
-					$this->insertAtIndexInPriority($item,$index,$priority);
650
+					$this->insertAtIndexInPriority($item, $index, $priority);
651 651
 			}
652
-		} else if(is_array($data)||$data instanceof \Traversable) {
653
-			if($this->getCount()>0)
652
+		} else if(is_array($data) || $data instanceof \Traversable) {
653
+			if($this->getCount() > 0)
654 654
 				$this->clear();
655 655
 			foreach($data as $key=>$item)
656 656
 				$this->add($item);
@@ -673,10 +673,10 @@  discard block
 block discarded – undo
673 673
 			foreach($data->getPriorities() as $priority)
674 674
 			{
675 675
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
676
-					$this->insertAtIndexInPriority($item,false,$priority);
676
+					$this->insertAtIndexInPriority($item, false, $priority);
677 677
 			}
678 678
 		}
679
-		else if(is_array($data)||$data instanceof \Traversable)
679
+		else if(is_array($data) || $data instanceof \Traversable)
680 680
 		{
681 681
 			foreach($data as $priority=>$item)
682 682
 				$this->add($item);
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 	 */
695 695
 	public function offsetExists($offset)
696 696
 	{
697
-		return ($offset>=0&&$offset<$this->getCount());
697
+		return ($offset >= 0 && $offset < $this->getCount());
698 698
 	}
699 699
 
700 700
 	/**
@@ -720,18 +720,18 @@  discard block
 block discarded – undo
720 720
 	 * @param integer the offset to set element
721 721
 	 * @param mixed the element value
722 722
 	 */
723
-	public function offsetSet($offset,$item)
723
+	public function offsetSet($offset, $item)
724 724
 	{
725 725
 		if($offset===null)
726 726
 			return $this->add($item);
727 727
 		if($offset===$this->getCount()) {
728
-			$priority=$this->priorityAt($offset-1,true);
728
+			$priority=$this->priorityAt($offset - 1, true);
729 729
 			$priority[1]++;
730 730
 		} else {
731
-			$priority=$this->priorityAt($offset,true);
732
-			$this->removeAtIndexInPriority($priority[1],$priority[0]);
731
+			$priority=$this->priorityAt($offset, true);
732
+			$this->removeAtIndexInPriority($priority[1], $priority[0]);
733 733
 		}
734
-		$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
734
+		$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
735 735
 	}
736 736
 
737 737
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveDatePicker.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function getAutoPostBack()
46 46
 	{
47
-		return $this->getViewState('AutoPostBack',true);
47
+		return $this->getViewState('AutoPostBack', true);
48 48
 	}
49 49
 
50 50
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function setAutoPostBack($value)
57 57
 	{
58
-		$this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true);
58
+		$this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true);
59 59
 	}
60 60
 
61 61
 	/**
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	protected function getDatePickerOptions()
66 66
 	{
67
-		$options = parent::getDatePickerOptions();
67
+		$options=parent::getDatePickerOptions();
68 68
 		$options['CausesValidation']=$this->getCausesValidation();
69 69
 		$options['ValidationGroup']=$this->getValidationGroup();
70
-		$options['EventTarget'] = $this->getUniqueID();
71
-		$options['ShowCalendar'] = $this->getShowCalendar();
72
-		$options['AutoPostBack'] = $this->getAutoPostBack();
70
+		$options['EventTarget']=$this->getUniqueID();
71
+		$options['ShowCalendar']=$this->getShowCalendar();
72
+		$options['AutoPostBack']=$this->getAutoPostBack();
73 73
 		return $options;
74 74
 	}
75 75
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	/**
88 88
 	 * @return TBaseActiveCallbackControl standard callback control options.
89 89
 	 */
90
-	public function getActiveControl(){
90
+	public function getActiveControl() {
91 91
 		return $this->getAdapter()->getBaseActiveControl();
92 92
 	}
93 93
 
@@ -95,21 +95,21 @@  discard block
 block discarded – undo
95 95
 	 * Client-side Text property can only be updated after the OnLoad stage.
96 96
 	 * @param string text content for the textbox
97 97
 	 */
98
-	public function setText($value){
99
-		if(parent::getText() === $value)
98
+	public function setText($value) {
99
+		if(parent::getText()===$value)
100 100
 			return;
101 101
 
102 102
 		parent::setText($value);
103
-		if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()){
103
+		if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) {
104 104
 			$cb=$this->getPage()->getCallbackClient();
105 105
 			$cb->setValue($this, $value);
106
-			if ($this->getInputMode()==TDatePickerInputMode::DropDownList)
106
+			if($this->getInputMode()==TDatePickerInputMode::DropDownList)
107 107
 			{
108
-				$dt = new \DateTime;
108
+				$dt=new \DateTime;
109 109
 				$dt->setTimeStamp($this->getTimeStampFromText());
110 110
 				$id=$this->getClientID();
111 111
 				$cb->select($id.TControl::CLIENT_ID_SEPARATOR.'day', 'Value', $dt->format('j'), 'select');
112
-				$cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $dt->format('n')-1, 'select');
112
+				$cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $dt->format('n') - 1, 'select');
113 113
 				$cb->select($id.TControl::CLIENT_ID_SEPARATOR.'year', 'Value', $dt->format('Y'), 'select');
114 114
 
115 115
 			}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * This method is mainly used by framework and control developers.
123 123
 	 * @param TCallbackEventParameter the event parameter
124 124
 	 */
125
- 	public function raiseCallbackEvent($param){
125
+ 	public function raiseCallbackEvent($param) {
126 126
 		$this->onCallback($param);
127 127
 	}
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * handler can be invoked.
134 134
 	 * @param TCallbackEventParameter event parameter to be passed to the event handlers
135 135
 	 */
136
-	public function onCallback($param){
136
+	public function onCallback($param) {
137 137
 		$this->raiseEvent('OnCallback', $this, $param);
138 138
 	}
139 139
 
@@ -143,22 +143,22 @@  discard block
 block discarded – undo
143 143
 
144 144
 	protected function registerCalendarClientScriptPre()
145 145
 	{
146
-		$cs = $this->getPage()->getClientScript();
146
+		$cs=$this->getPage()->getClientScript();
147 147
 		$cs->registerPradoScript("activedatepicker");
148 148
 	}
149 149
 
150 150
 	protected function renderClientControlScript($writer)
151 151
 	{
152
-		$cs = $this->getPage()->getClientScript();
152
+		$cs=$this->getPage()->getClientScript();
153 153
 		if(!$cs->isEndScriptRegistered('TDatePicker.spacer'))
154 154
 		{
155
-			$spacer = $this->getAssetUrl('spacer.gif');
156
-			$code = "Prado.WebUI.TDatePicker.spacer = '$spacer';";
155
+			$spacer=$this->getAssetUrl('spacer.gif');
156
+			$code="Prado.WebUI.TDatePicker.spacer = '$spacer';";
157 157
 			$cs->registerEndScript('TDatePicker.spacer', $code);
158 158
 		}
159 159
 
160
-		$options = TJavaScript::encode($this->getDatePickerOptions());
161
-		$code = "new Prado.WebUI.TActiveDatePicker($options);";
160
+		$options=TJavaScript::encode($this->getDatePickerOptions());
161
+		$code="new Prado.WebUI.TActiveDatePicker($options);";
162 162
 		$cs->registerEndScript("prado:".$this->getClientID(), $code);
163 163
 	}
164 164
 
Please login to merge, or discard this patch.
framework/I18N/core/DateFormat.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 	/**
84 84
 	 * The DateTimeFormatInfo, containing culture specific patterns and names.
85
- 	 * @var DateTimeFormatInfo
85
+	 * @var DateTimeFormatInfo
86 86
 	 */
87 87
 	protected $formatInfo;
88 88
 
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
 
311 311
 	/**
312 312
 	 * Get the year.
313
- 	 * "yy" will return the last two digits of year.
314
- 	 * "yyyy" will return the full integer year.
313
+	 * "yy" will return the last two digits of year.
314
+	 * "yyyy" will return the full integer year.
315 315
 	 * @param array getdate format.
316 316
 	 * @param string a pattern.
317 317
 	 * @return string year
@@ -331,10 +331,10 @@  discard block
 block discarded – undo
331 331
 
332 332
 	/**
333 333
 	 * Get the month.
334
- 	 * "M" will return integer 1 through 12
335
- 	 * "MM" will return the narrow month name, e.g. "J"
336
- 	 * "MMM" will return the abrreviated month name, e.g. "Jan"
337
- 	 * "MMMM" will return the month name, e.g. "January"
334
+	 * "M" will return integer 1 through 12
335
+	 * "MM" will return the narrow month name, e.g. "J"
336
+	 * "MMM" will return the abrreviated month name, e.g. "Jan"
337
+	 * "MMMM" will return the month name, e.g. "January"
338 338
 	 * @param array getdate format.
339 339
 	 * @param string a pattern.
340 340
 	 * @return string month name
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 
359 359
 	/**
360 360
 	 * Get the day of the week.
361
- 	 * "E" will return integer 0 (for Sunday) through 6 (for Saturday).
362
- 	 * "EE" will return the narrow day of the week, e.g. "M"
363
- 	 * "EEE" will return the abrreviated day of the week, e.g. "Mon"
364
- 	 * "EEEE" will return the day of the week, e.g. "Monday"
361
+	 * "E" will return integer 0 (for Sunday) through 6 (for Saturday).
362
+	 * "EE" will return the narrow day of the week, e.g. "M"
363
+	 * "EEE" will return the abrreviated day of the week, e.g. "Mon"
364
+	 * "EEEE" will return the day of the week, e.g. "Monday"
365 365
 	 * @param array getdate format.
366 366
 	 * @param string a pattern.
367 367
 	 * @return string day of the week.
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 	/**
388 388
 	 * Get the day of the month.
389
- 	 * "d" for non-padding, "dd" will always return 2 characters.
389
+	 * "d" for non-padding, "dd" will always return 2 characters.
390 390
 	 * @param array getdate format.
391 391
 	 * @param string a pattern.
392 392
 	 * @return string day of the month
@@ -558,12 +558,12 @@  discard block
 block discarded – undo
558 558
 	protected function getDayInMonth($date, $pattern='FF')
559 559
 	{
560 560
 		switch ($pattern) {
561
-		    case 'F':
562
-		    	return $date->format('j');
563
-		    case 'FF':
564
-		    	return $date->format('d');
565
-		    default:
566
-		    	throw new Exception('The pattern for day in month is "F" or "FF".');
561
+			case 'F':
562
+				return $date->format('j');
563
+			case 'FF':
564
+				return $date->format('d');
565
+			default:
566
+				throw new Exception('The pattern for day in month is "F" or "FF".');
567 567
 		}
568 568
 	}
569 569
 
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * A list of tokens and their function call.
55 55
 	 * @var array
56 56
 	 */
57
-	protected $tokens = array(
57
+	protected $tokens=array(
58 58
 			'G'=>'Era',
59 59
 			'y'=>'Year',
60 60
 			'M'=>'Month',
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * A list of methods, to be used by the token function calls.
79 79
 	 * @var array
80 80
 	 */
81
-	protected $methods = array();
81
+	protected $methods=array();
82 82
 
83 83
 	/**
84 84
 	 * The DateTimeFormatInfo, containing culture specific patterns and names.
@@ -94,16 +94,16 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	function __construct($formatInfo=null)
96 96
 	{
97
-		if($formatInfo === null)
98
-			$this->formatInfo = DateTimeFormatInfo::getInvariantInfo();
97
+		if($formatInfo===null)
98
+			$this->formatInfo=DateTimeFormatInfo::getInvariantInfo();
99 99
 		else if($formatInfo instanceof CultureInfo)
100
-			$this->formatInfo = $formatInfo->DateTimeFormat;
100
+			$this->formatInfo=$formatInfo->DateTimeFormat;
101 101
 		else if($formatInfo instanceof DateTimeFormatInfo)
102
-			$this->formatInfo = $formatInfo;
102
+			$this->formatInfo=$formatInfo;
103 103
 		else
104
-			$this->formatInfo = DateTimeFormatInfo::getInstance($formatInfo);
104
+			$this->formatInfo=DateTimeFormatInfo::getInstance($formatInfo);
105 105
 
106
-		$this->methods = get_class_methods($this);
106
+		$this->methods=get_class_methods($this);
107 107
 	}
108 108
 
109 109
 	/**
@@ -113,44 +113,44 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function format($time, $pattern='F', $charset='UTF-8')
115 115
 	{
116
-		if (is_numeric($time)) //assumes unix epoch
117
-			$time = floatval($time);
116
+		if(is_numeric($time)) //assumes unix epoch
117
+			$time=floatval($time);
118 118
 		else if(is_string($time))
119
-			$time = @strtotime($time);
119
+			$time=@strtotime($time);
120 120
 
121
-		if($pattern === null)
122
-			$pattern = 'F';
121
+		if($pattern===null)
122
+			$pattern='F';
123 123
 
124
-		$date = new \DateTime;
124
+		$date=new \DateTime;
125 125
 		$date->setTimestamp($time);
126 126
 
127
-		$pattern = $this->getPattern($pattern);
127
+		$pattern=$this->getPattern($pattern);
128 128
 
129
-		$tokens = $this->getTokens($pattern);
129
+		$tokens=$this->getTokens($pattern);
130 130
 
131
-		for($i = 0, $k = count($tokens); $i<$k; ++$i)
131
+		for($i=0, $k=count($tokens); $i < $k; ++$i)
132 132
 		{
133
-			$pattern = $tokens[$i];
134
-			if($pattern{0} == "'"
135
-				&& $pattern{strlen($pattern)-1} == "'")
133
+			$pattern=$tokens[$i];
134
+			if($pattern{0}=="'"
135
+				&& $pattern{strlen($pattern) - 1}=="'")
136 136
 			{
137
-				$sub = preg_replace('/(^\')|(\'$)/','',$pattern);
138
-				$tokens[$i] =  str_replace('``````','\'',$sub);
137
+				$sub=preg_replace('/(^\')|(\'$)/', '', $pattern);
138
+				$tokens[$i]=str_replace('``````', '\'', $sub);
139 139
 			}
140
-			else if($pattern == '``````')
140
+			else if($pattern=='``````')
141 141
 			{
142
-				$tokens[$i] = '\'';
142
+				$tokens[$i]='\'';
143 143
 			}
144 144
 			else
145 145
 			{
146
-				$function = $this->getFunctionName($pattern);
147
-				if($function != null)
146
+				$function=$this->getFunctionName($pattern);
147
+				if($function!=null)
148 148
 				{
149
-					$fName = 'get'.$function;
149
+					$fName='get'.$function;
150 150
 					if(in_array($fName, $this->methods))
151 151
 					{
152
-						$rs = $this->$fName($date, $pattern);
153
-						$tokens[$i] = $rs;
152
+						$rs=$this->$fName($date, $pattern);
153
+						$tokens[$i]=$rs;
154 154
 					}
155 155
 					else
156 156
 						throw new
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			}			
160 160
 		}
161 161
 
162
-		return I18N_toEncoding(implode('',$tokens), $charset);
162
+		return I18N_toEncoding(implode('', $tokens), $charset);
163 163
 	}
164 164
 
165 165
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	protected function getPattern($pattern)
188 188
 	{
189
-		if(is_array($pattern) && count($pattern) == 2)
189
+		if(is_array($pattern) && count($pattern)==2)
190 190
 		{
191 191
 			return $this->formatInfo->formatDateTime(
192 192
 							$this->getPattern($pattern[0]),
@@ -275,36 +275,36 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	protected function getTokens($pattern)
277 277
 	{
278
-		$char = null;
279
-		$tokens = array();
280
-		$token = null;
278
+		$char=null;
279
+		$tokens=array();
280
+		$token=null;
281 281
 
282
-		$text = false;
283
-		$pattern = preg_replace("/''/", '``````', $pattern);
282
+		$text=false;
283
+		$pattern=preg_replace("/''/", '``````', $pattern);
284 284
 
285
-		for($i = 0; $i < strlen($pattern); $i++)
285
+		for($i=0; $i < strlen($pattern); $i++)
286 286
 		{
287
-			if($char==null || $pattern{$i} == $char || $text)
287
+			if($char==null || $pattern{$i}==$char || $text)
288 288
 			{
289
-				$token .= $pattern{$i};
289
+				$token.=$pattern{$i};
290 290
 			}
291 291
 			else
292 292
 			{
293
-				$tokens[] = str_replace("","'",$token);
294
-				$token = $pattern{$i};
293
+				$tokens[]=str_replace("", "'", $token);
294
+				$token=$pattern{$i};
295 295
 			}
296 296
 
297
-			if($pattern{$i} == "'" && $text == false)
298
-				$text = true;
299
-			else if($text && $pattern{$i} == "'" && $char == "'")
300
-				$text = true;
301
-			else if($text && $char != "'" && $pattern{$i} == "'")
302
-				$text = false;
297
+			if($pattern{$i}=="'" && $text==false)
298
+				$text=true;
299
+			else if($text && $pattern{$i}=="'" && $char=="'")
300
+				$text=true;
301
+			else if($text && $char!="'" && $pattern{$i}=="'")
302
+				$text=false;
303 303
 
304
-			$char = $pattern{$i};
304
+			$char=$pattern{$i};
305 305
 
306 306
 		}
307
-		$tokens[] = $token;
307
+		$tokens[]=$token;
308 308
 		return $tokens;
309 309
 	}
310 310
 
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 			case 'MM':
349 349
 				return $date->format('m');
350 350
 			case 'MMM':
351
-				return $this->formatInfo->AbbreviatedMonthNames[$date->format('n')-1];
351
+				return $this->formatInfo->AbbreviatedMonthNames[$date->format('n') - 1];
352 352
 			case 'MMMM':
353
-				return $this->formatInfo->MonthNames[$date->format('n')-1];
353
+				return $this->formatInfo->MonthNames[$date->format('n') - 1];
354 354
 			default:
355 355
 				throw new Exception('The pattern for month is "M", "MM", "MMM", or "MMMM".');
356 356
 		}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 */
369 369
 	protected function getDayInWeek($date, $pattern='EEEE')
370 370
 	{
371
-		$day = $date->format('w');
371
+		$day=$date->format('w');
372 372
 		switch($pattern)
373 373
 		{
374 374
 			case 'E':
@@ -414,10 +414,10 @@  discard block
 block discarded – undo
414 414
 	 */
415 415
 	protected function getEra($date, $pattern='G')
416 416
 	{
417
-		if($pattern != 'G')
417
+		if($pattern!='G')
418 418
 			throw new Exception('The pattern for era is "G".');
419 419
 
420
-		$year = $date->format('Y');
420
+		$year=$date->format('Y');
421 421
 		if($year > 0)
422 422
 			return $this->formatInfo->getEra(1);
423 423
 		else
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
 	 */
453 453
 	protected function getAMPM($date, $pattern='a')
454 454
 	{
455
-		if($pattern != 'a')
455
+		if($pattern!='a')
456 456
 			throw new Exception('The pattern for AM/PM marker is "a".');
457 457
 
458
-		$hour = $date->format('G');
459
-		$ampm = (int)($hour/12);
458
+		$hour=$date->format('G');
459
+		$ampm=(int) ($hour / 12);
460 460
 		return $this->formatInfo->AMPMMarkers[$ampm];
461 461
 	}
462 462
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	 */
530 530
 	protected function getTimeZone($date, $pattern='z')
531 531
 	{
532
-		if($pattern != 'z')
532
+		if($pattern!='z')
533 533
 			throw new Exception('The pattern for time zone is "z".');
534 534
 
535 535
 		return $date->format('T');
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	 */
544 544
 	protected function getDayInYear($date, $pattern='D')
545 545
 	{
546
-		if($pattern != 'D')
546
+		if($pattern!='D')
547 547
 			throw new Exception('The pattern for day in year is "D".');
548 548
 
549 549
 		return $date->format('z');
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	protected function getDayInMonth($date, $pattern='FF')
559 559
 	{
560
-		switch ($pattern) {
560
+		switch($pattern) {
561 561
 		    case 'F':
562 562
 		    	return $date->format('j');
563 563
 		    case 'FF':
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	 */
576 576
 	protected function getWeekInYear($date, $pattern='w')
577 577
 	{
578
-		if($pattern != 'w')
578
+		if($pattern!='w')
579 579
 			throw new Exception('The pattern for week in year is "w".');
580 580
 
581 581
 		return $date->format('W');
@@ -588,10 +588,10 @@  discard block
 block discarded – undo
588 588
 	 */
589 589
 	protected function getWeekInMonth($date, $pattern='W')
590 590
 	{
591
-		if($pattern != 'W')
591
+		if($pattern!='W')
592 592
 			throw new Exception('The pattern for week in month is "W".');
593 593
 
594
-		$firstInMonth = clone($date);
594
+		$firstInMonth=clone($date);
595 595
 		$firstInMonth->setDate($firstInMonth->format('Y'), $firstInMonth->format('m'), 1);
596 596
 		return $date->format('W') - $firstInMonth->format('W');
597 597
 	}
@@ -604,10 +604,10 @@  discard block
 block discarded – undo
604 604
 	 */
605 605
 	protected function getHourInDay($date, $pattern='k')
606 606
 	{
607
-		if($pattern != 'k')
607
+		if($pattern!='k')
608 608
 			throw new Exception('The pattern for hour in day is "k".');
609 609
 
610
-		return $date->format('G')+1;
610
+		return $date->format('G') + 1;
611 611
 	}
612 612
 
613 613
 	/**
@@ -618,9 +618,9 @@  discard block
 block discarded – undo
618 618
 	 */
619 619
 	protected function getHourInAMPM($date, $pattern='K')
620 620
 	{
621
-		if($pattern != 'K')
621
+		if($pattern!='K')
622 622
 			throw new Exception('The pattern for hour in AM/PM is "K".');
623 623
 
624
-		return $date->format('g')+1;
624
+		return $date->format('g') + 1;
625 625
 	}
626 626
 }
Please login to merge, or discard this patch.
framework/Caching/TMemCache.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -105,17 +105,17 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	private $_port=11211;
107 107
 
108
-    private $_timeout = 360;
108
+	private $_timeout = 360;
109 109
 
110 110
 	/**
111
-	* @var integer Controls the minimum value length before attempting to compress automatically.
112
-	*/
113
-    private $_threshold=0;
111
+	 * @var integer Controls the minimum value length before attempting to compress automatically.
112
+	 */
113
+	private $_threshold=0;
114 114
 
115 115
 	/**
116
-	* @var float Specifies the minimum amount of savings to actually store the value compressed. The supplied value must be between 0 and 1. Default value is 0.2 giving a minimum 20% compression savings.
117
-	*/
118
-    private $_minSavings=0.0;
116
+	 * @var float Specifies the minimum amount of savings to actually store the value compressed. The supplied value must be between 0 and 1. Default value is 0.2 giving a minimum 20% compression savings.
117
+	 */
118
+	private $_minSavings=0.0;
119 119
 
120 120
 	/**
121 121
 	 * @var boolean whether to use memcached or memcache as the underlying caching extension.
@@ -159,63 +159,63 @@  discard block
 block discarded – undo
159 159
 		$this->_cache = $this->_useMemcached ? new Memcached : new Memcache;
160 160
 		$this->loadConfig($config);
161 161
 		if(count($this->_servers))
162
-        {
163
-            foreach($this->_servers as $server)
164
-            {
165
-                Prado::trace('Adding server '.$server['Host'].' from serverlist', '\Prado\Caching\TMemCache');
166
-                if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'],
167
-                    $server['Weight'],$server['Timeout'],$server['RetryInterval'])===false)
168
-                    throw new TConfigurationException('memcache_connection_failed',$server['Host'],$server['Port']);
169
-            }
170
-        }
171
-        else
172
-        {
173
-            Prado::trace('Adding server '.$this->_host, '\Prado\Caching\TMemCache');
174
-            if($this->_cache->addServer($this->_host,$this->_port)===false)
175
-                throw new TConfigurationException('memcache_connection_failed',$this->_host,$this->_port);
176
-        }
162
+		{
163
+			foreach($this->_servers as $server)
164
+			{
165
+				Prado::trace('Adding server '.$server['Host'].' from serverlist', '\Prado\Caching\TMemCache');
166
+				if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'],
167
+					$server['Weight'],$server['Timeout'],$server['RetryInterval'])===false)
168
+					throw new TConfigurationException('memcache_connection_failed',$server['Host'],$server['Port']);
169
+			}
170
+		}
171
+		else
172
+		{
173
+			Prado::trace('Adding server '.$this->_host, '\Prado\Caching\TMemCache');
174
+			if($this->_cache->addServer($this->_host,$this->_port)===false)
175
+				throw new TConfigurationException('memcache_connection_failed',$this->_host,$this->_port);
176
+		}
177 177
 		if($this->_threshold!==0)
178
-            $this->_cache->setCompressThreshold($this->_threshold,$this->_minSavings);
178
+			$this->_cache->setCompressThreshold($this->_threshold,$this->_minSavings);
179 179
 		$this->_initialized=true;
180 180
 		parent::init($config);
181 181
 	}
182 182
 
183
-    /**
183
+	/**
184 184
 	 * Loads configuration from an XML element
185 185
 	 * @param TXmlElement configuration node
186 186
 	 * @throws TConfigurationException if log route class or type is not specified
187 187
 	 */
188 188
 	private function loadConfig($xml)
189 189
 	{
190
-	    if($xml instanceof TXmlElement)
190
+		if($xml instanceof TXmlElement)
191 191
 		{
192
-    		foreach($xml->getElementsByTagName('server') as $serverConfig)
193
-    		{
194
-    			$properties=$serverConfig->getAttributes();
195
-    			if(($host=$properties->remove('Host'))===null)
196
-    				throw new TConfigurationException('memcache_serverhost_required');
197
-    			if(($port=$properties->remove('Port'))===null)
198
-        			throw new TConfigurationException('memcache_serverport_required');
199
-        		if(!is_numeric($port))
200
-        		    throw new TConfigurationException('memcache_serverport_invalid');
201
-        		$server = array('Host'=>$host,'Port'=>$port,'Weight'=>1,'Timeout'=>1800,'RetryInterval'=>15,'Persistent'=>true);
202
-        		$checks = array(
203
-        		    'Weight'=>'memcache_serverweight_invalid',
204
-        		    'Timeout'=>'memcache_servertimeout_invalid',
205
-        		    'RetryInterval'=>'memcach_serverretryinterval_invalid'
206
-        		);
207
-        		foreach($checks as $property=>$exception)
208
-        		{
209
-        		    $value=$properties->remove($property);
210
-        		    if($value!==null && is_numeric($value))
211
-        		        $server[$property]=$value;
212
-        		    else if($value!==null)
213
-        		        throw new TConfigurationException($exception);
214
-        		}
215
-        		$server['Persistent']= TPropertyValue::ensureBoolean($properties->remove('Persistent'));
216
-    			$this->_servers[]=$server;
217
-    		}
218
-	    }
192
+			foreach($xml->getElementsByTagName('server') as $serverConfig)
193
+			{
194
+				$properties=$serverConfig->getAttributes();
195
+				if(($host=$properties->remove('Host'))===null)
196
+					throw new TConfigurationException('memcache_serverhost_required');
197
+				if(($port=$properties->remove('Port'))===null)
198
+					throw new TConfigurationException('memcache_serverport_required');
199
+				if(!is_numeric($port))
200
+					throw new TConfigurationException('memcache_serverport_invalid');
201
+				$server = array('Host'=>$host,'Port'=>$port,'Weight'=>1,'Timeout'=>1800,'RetryInterval'=>15,'Persistent'=>true);
202
+				$checks = array(
203
+					'Weight'=>'memcache_serverweight_invalid',
204
+					'Timeout'=>'memcache_servertimeout_invalid',
205
+					'RetryInterval'=>'memcach_serverretryinterval_invalid'
206
+				);
207
+				foreach($checks as $property=>$exception)
208
+				{
209
+					$value=$properties->remove($property);
210
+					if($value!==null && is_numeric($value))
211
+						$server[$property]=$value;
212
+					else if($value!==null)
213
+						throw new TConfigurationException($exception);
214
+				}
215
+				$server['Persistent']= TPropertyValue::ensureBoolean($properties->remove('Persistent'));
216
+				$this->_servers[]=$server;
217
+			}
218
+		}
219 219
 	}
220 220
 
221 221
 	/**
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	private $_port=11211;
107 107
 
108
-    private $_timeout = 360;
108
+    private $_timeout=360;
109 109
 
110 110
 	/**
111 111
 	* @var integer Controls the minimum value length before attempting to compress automatically.
@@ -156,26 +156,26 @@  discard block
 block discarded – undo
156 156
 		if(!extension_loaded('memcached') && $this->_useMemcached)
157 157
 			throw new TConfigurationException('memcached_extension_required');
158 158
 		
159
-		$this->_cache = $this->_useMemcached ? new Memcached : new Memcache;
159
+		$this->_cache=$this->_useMemcached ? new Memcached : new Memcache;
160 160
 		$this->loadConfig($config);
161 161
 		if(count($this->_servers))
162 162
         {
163 163
             foreach($this->_servers as $server)
164 164
             {
165 165
                 Prado::trace('Adding server '.$server['Host'].' from serverlist', '\Prado\Caching\TMemCache');
166
-                if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'],
167
-                    $server['Weight'],$server['Timeout'],$server['RetryInterval'])===false)
168
-                    throw new TConfigurationException('memcache_connection_failed',$server['Host'],$server['Port']);
166
+                if($this->_cache->addServer($server['Host'], $server['Port'], $server['Persistent'],
167
+                    $server['Weight'], $server['Timeout'], $server['RetryInterval'])===false)
168
+                    throw new TConfigurationException('memcache_connection_failed', $server['Host'], $server['Port']);
169 169
             }
170 170
         }
171 171
         else
172 172
         {
173 173
             Prado::trace('Adding server '.$this->_host, '\Prado\Caching\TMemCache');
174
-            if($this->_cache->addServer($this->_host,$this->_port)===false)
175
-                throw new TConfigurationException('memcache_connection_failed',$this->_host,$this->_port);
174
+            if($this->_cache->addServer($this->_host, $this->_port)===false)
175
+                throw new TConfigurationException('memcache_connection_failed', $this->_host, $this->_port);
176 176
         }
177 177
 		if($this->_threshold!==0)
178
-            $this->_cache->setCompressThreshold($this->_threshold,$this->_minSavings);
178
+            $this->_cache->setCompressThreshold($this->_threshold, $this->_minSavings);
179 179
 		$this->_initialized=true;
180 180
 		parent::init($config);
181 181
 	}
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
         			throw new TConfigurationException('memcache_serverport_required');
199 199
         		if(!is_numeric($port))
200 200
         		    throw new TConfigurationException('memcache_serverport_invalid');
201
-        		$server = array('Host'=>$host,'Port'=>$port,'Weight'=>1,'Timeout'=>1800,'RetryInterval'=>15,'Persistent'=>true);
202
-        		$checks = array(
201
+        		$server=array('Host'=>$host, 'Port'=>$port, 'Weight'=>1, 'Timeout'=>1800, 'RetryInterval'=>15, 'Persistent'=>true);
202
+        		$checks=array(
203 203
         		    'Weight'=>'memcache_serverweight_invalid',
204 204
         		    'Timeout'=>'memcache_servertimeout_invalid',
205 205
         		    'RetryInterval'=>'memcach_serverretryinterval_invalid'
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         		    else if($value!==null)
213 213
         		        throw new TConfigurationException($exception);
214 214
         		}
215
-        		$server['Persistent']= TPropertyValue::ensureBoolean($properties->remove('Persistent'));
215
+        		$server['Persistent']=TPropertyValue::ensureBoolean($properties->remove('Persistent'));
216 216
     			$this->_servers[]=$server;
217 217
     		}
218 218
 	    }
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
339 339
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
340 340
 	 */
341
-	protected function setValue($key,$value,$expire)
341
+	protected function setValue($key, $value, $expire)
342 342
 	{
343 343
 		if($this->_useMemcached) {
344
-			return $this->_cache->set($key,$value,$expire);
344
+			return $this->_cache->set($key, $value, $expire);
345 345
 		} else {
346
-			return $this->_cache->set($key,$value,0,$expire);
346
+			return $this->_cache->set($key, $value, 0, $expire);
347 347
 		}
348 348
 	}
349 349
 
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
357 357
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
358 358
 	 */
359
-	protected function addValue($key,$value,$expire)
359
+	protected function addValue($key, $value, $expire)
360 360
 	{
361 361
 		if($this->_useMemcached) {
362
-			$this->_cache->add($key,$value,$expire);
362
+			$this->_cache->add($key, $value, $expire);
363 363
 		} else {
364
-			return $this->_cache->add($key,$value,0,$expire);
364
+			return $this->_cache->add($key, $value, 0, $expire);
365 365
 		}
366 366
 	}
367 367
 
Please login to merge, or discard this patch.