Completed
Push — php-cs-fixer ( b6f93e...b9836a )
by Fabio
07:15
created
framework/Web/UI/WebControls/TDatePicker.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -425,8 +425,7 @@  discard block
 block discarded – undo
425 425
 		{
426 426
 			parent::render($writer);
427 427
 			$this->renderDatePickerButtons($writer);
428
-		}
429
-		else
428
+		} else
430 429
 		{
431 430
 			$this->renderDropDownListCalendar($writer);
432 431
 			if($this->hasDayPattern())
@@ -473,8 +472,7 @@  discard block
 block discarded – undo
473 472
 		{
474 473
 			$this->setText($value);
475 474
 			return true;
476
-		}
477
-		else
475
+		} else
478 476
 			return false;
479 477
 	}
480 478
 
Please login to merge, or discard this patch.
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   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	/**
86 86
 	 * Script path relative to the TClientScriptManager::SCRIPT_PATH
87 87
 	 */
88
-	const SCRIPT_PATH = 'datepicker';
88
+	const SCRIPT_PATH='datepicker';
89 89
 
90 90
 	/**
91 91
 	 * @var TDatePickerClientScript validator client-script options.
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function getTimeStamp()
303 303
 	{
304
-		if(trim($this->getText()) === '')
304
+		if(trim($this->getText())==='')
305 305
 			return null;
306 306
 		else
307 307
 			return $this->getTimeStampFromText();
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	public function setTimeStamp($value)
315 315
 	{
316
-		if($value === null || (is_string($value) && trim($value) === ''))
316
+		if($value===null || (is_string($value) && trim($value)===''))
317 317
 			$this->setText('');
318 318
 		else
319 319
 		{
320
-			$date = TPropertyValue::ensureFloat($value);
321
-			$formatter = new TSimpleDateFormatter($this->getDateFormat());
320
+			$date=TPropertyValue::ensureFloat($value);
321
+			$formatter=new TSimpleDateFormatter($this->getDateFormat());
322 322
 			$this->setText($formatter->format($date));
323 323
 		}
324 324
 	}
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	public function getClientSide()
379 379
 	{
380
-		if($this->_clientScript === null)
381
-			$this->_clientScript = $this->createClientScript();
380
+		if($this->_clientScript===null)
381
+			$this->_clientScript=$this->createClientScript();
382 382
 		return $this->_clientScript;
383 383
 	}
384 384
 
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 	 */
398 398
 	public function getValidationPropertyValue()
399 399
 	{
400
-		if(($text = $this->getText()) === '')
400
+		if(($text=$this->getText())==='')
401 401
 			return '';
402
-		$date = $this->getTimeStamp();
403
-		return $date == null ? $text : $date;
402
+		$date=$this->getTimeStamp();
403
+		return $date==null ? $text : $date;
404 404
 	}
405 405
 
406 406
 	/**
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	 */
422 422
 	public function render($writer)
423 423
 	{
424
-		if($this->getInputMode() == TDatePickerInputMode::TextBox)
424
+		if($this->getInputMode()==TDatePickerInputMode::TextBox)
425 425
 		{
426 426
 			parent::render($writer);
427 427
 			$this->renderDatePickerButtons($writer);
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	{
445 445
 		if($this->getShowCalendar())
446 446
 		{
447
-			switch ($this->getMode())
447
+			switch($this->getMode())
448 448
 			{
449 449
 				case TDatePickerMode::Button:
450 450
 					$this->renderButtonDatePicker($writer);
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 	 */
467 467
 	public function loadPostData($key, $values)
468 468
 	{
469
-		if($this->getInputMode() == TDatePickerInputMode::TextBox)
469
+		if($this->getInputMode()==TDatePickerInputMode::TextBox)
470 470
 			return parent::loadPostData($key, $values);
471
-		$value = $this->getDateFromPostData($key, $values);
472
-		if(!$this->getReadOnly() && $this->getText() !== $value)
471
+		$value=$this->getDateFromPostData($key, $values);
472
+		if(!$this->getReadOnly() && $this->getText()!==$value)
473 473
 		{
474 474
 			$this->setText($value);
475 475
 			return true;
@@ -486,42 +486,42 @@  discard block
 block discarded – undo
486 486
 	 */
487 487
 	protected function getDateFromPostData($key, $values)
488 488
 	{
489
-		$date = @getdate();
489
+		$date=@getdate();
490 490
 
491
-		$pattern = $this->getDateFormat();
492
-		$pattern = str_replace(['MMMM', 'MMM'], ['MM','MM'], $pattern);
493
-		$formatter = new TSimpleDateFormatter($pattern);
491
+		$pattern=$this->getDateFormat();
492
+		$pattern=str_replace(['MMMM', 'MMM'], ['MM', 'MM'], $pattern);
493
+		$formatter=new TSimpleDateFormatter($pattern);
494 494
 
495
-		$order = $formatter->getDayMonthYearOrdering();
495
+		$order=$formatter->getDayMonthYearOrdering();
496 496
 
497
-		if(isset($values[$key . '$day'])) {
498
-			$day = intval($values[$key . '$day']);
497
+		if(isset($values[$key.'$day'])) {
498
+			$day=intval($values[$key.'$day']);
499 499
 		} elseif(in_array('day', $order)) {
500
-			$day = $date['mday'];
500
+			$day=$date['mday'];
501 501
 		} else {
502
-			$day = 1;
502
+			$day=1;
503 503
 		}
504 504
 
505
-		if(isset($values[$key . '$month']))
506
-			$month = intval($values[$key . '$month']) + 1;
505
+		if(isset($values[$key.'$month']))
506
+			$month=intval($values[$key.'$month']) + 1;
507 507
 		else
508
-			$month = $date['mon'];
508
+			$month=$date['mon'];
509 509
 
510
-		if(isset($values[$key . '$year']))
511
-			$year = intval($values[$key . '$year']);
510
+		if(isset($values[$key.'$year']))
511
+			$year=intval($values[$key.'$year']);
512 512
 		else
513
-			$year = $date['year'];
513
+			$year=$date['year'];
514 514
 
515
-		$s = new \DateTime;
515
+		$s=new \DateTime;
516 516
 		$s->setDate($year, $month, $day);
517 517
 		$s->setTime(0, 0, 0);
518
-		$date = $s->getTimeStamp();
518
+		$date=$s->getTimeStamp();
519 519
 		//$date = @mktime(0, 0, 0, $month, $day, $year);
520 520
 
521
-		$pattern = $this->getDateFormat();
522
-		$pattern = str_replace(['MMMM', 'MMM'], ['MM','MM'], $pattern);
521
+		$pattern=$this->getDateFormat();
522
+		$pattern=str_replace(['MMMM', 'MMM'], ['MM', 'MM'], $pattern);
523 523
 
524
-		$formatter = new TSimpleDateFormatter($pattern);
524
+		$formatter=new TSimpleDateFormatter($pattern);
525 525
 		return $formatter->format($date);
526 526
 	}
527 527
 
@@ -531,31 +531,31 @@  discard block
 block discarded – undo
531 531
 	 */
532 532
 	protected function getDatePickerOptions()
533 533
 	{
534
-		$options['ID'] = $this->getClientID();
535
-		$options['InputMode'] = $this->getInputMode();
536
-		$options['Format'] = $this->getDateFormat();
537
-		$options['FirstDayOfWeek'] = $this->getFirstDayOfWeek();
538
-		if(($cssClass = $this->getCssClass()) !== '')
539
-			$options['ClassName'] = $cssClass;
540
-		$options['CalendarStyle'] = $this->getCalendarStyle();
541
-		$options['FromYear'] = $this->getFromYear();
542
-		$options['UpToYear'] = $this->getUpToYear();
534
+		$options['ID']=$this->getClientID();
535
+		$options['InputMode']=$this->getInputMode();
536
+		$options['Format']=$this->getDateFormat();
537
+		$options['FirstDayOfWeek']=$this->getFirstDayOfWeek();
538
+		if(($cssClass=$this->getCssClass())!=='')
539
+			$options['ClassName']=$cssClass;
540
+		$options['CalendarStyle']=$this->getCalendarStyle();
541
+		$options['FromYear']=$this->getFromYear();
542
+		$options['UpToYear']=$this->getUpToYear();
543 543
 		switch($this->getMode())
544 544
 		{
545 545
 			case TDatePickerMode::Basic:
546 546
 				break;
547 547
 			case TDatePickerMode::Clickable:
548
-				$options['TriggerEvent'] = "click";
548
+				$options['TriggerEvent']="click";
549 549
 				break;
550 550
 			default:
551
-				$options['Trigger'] = $this->getDatePickerButtonID();
551
+				$options['Trigger']=$this->getDatePickerButtonID();
552 552
 				break;
553 553
 		}
554
-		$options['PositionMode'] = $this->getPositionMode();
554
+		$options['PositionMode']=$this->getPositionMode();
555 555
 
556
-		$options = array_merge($options, $this->getCulturalOptions());
557
-		if($this->_clientScript !== null)
558
-			$options = array_merge($options,
556
+		$options=array_merge($options, $this->getCulturalOptions());
557
+		if($this->_clientScript!==null)
558
+			$options=array_merge($options,
559 559
 				$this->_clientScript->getOptions()->toArray());
560 560
 		return $options;
561 561
 	}
@@ -566,13 +566,13 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	protected function getCulturalOptions()
568 568
 	{
569
-		if($this->getCurrentCulture() == 'en')
569
+		if($this->getCurrentCulture()=='en')
570 570
 			return [];
571 571
 
572
-		$date = $this->getLocalizedCalendarInfo();
573
-		$options['MonthNames'] = $date->getMonthNames();
574
-		$options['AbbreviatedMonthNames'] = $date->getAbbreviatedMonthNames();
575
-		$options['ShortWeekDayNames'] = $date->getAbbreviatedDayNames();
572
+		$date=$this->getLocalizedCalendarInfo();
573
+		$options['MonthNames']=$date->getMonthNames();
574
+		$options['AbbreviatedMonthNames']=$date->getAbbreviatedMonthNames();
575
+		$options['ShortWeekDayNames']=$date->getAbbreviatedDayNames();
576 576
 
577 577
 		return $options;
578 578
 	}
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
 	 */
583 583
 	protected function getCurrentCulture()
584 584
 	{
585
-		$app = $this->getApplication()->getGlobalization(false);
586
-		return $this->getCulture() == '' ?
585
+		$app=$this->getApplication()->getGlobalization(false);
586
+		return $this->getCulture()=='' ?
587 587
 				($app ? $app->getCulture() : 'en') : $this->getCulture();
588 588
 	}
589 589
 
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 	protected function getLocalizedCalendarInfo()
594 594
 	{
595 595
 		//expensive operations
596
-		$culture = $this->getCurrentCulture();
597
-		$info = new CultureInfo($culture);
596
+		$culture=$this->getCurrentCulture();
597
+		$info=new CultureInfo($culture);
598 598
 		return $info->getDateTimeFormat();
599 599
 	}
600 600
 
@@ -603,18 +603,18 @@  discard block
 block discarded – undo
603 603
 	 */
604 604
 	protected function renderDropDownListCalendar($writer)
605 605
 	{
606
-		if($this->getMode() == TDatePickerMode::Basic)
606
+		if($this->getMode()==TDatePickerMode::Basic)
607 607
 			$this->setMode(TDatePickerMode::ImageButton);
608 608
 		parent::addAttributesToRender($writer);
609 609
 		$writer->removeAttribute('name');
610 610
 		$writer->removeAttribute('type');
611 611
 		$writer->addAttribute('id', $this->getClientID());
612 612
 
613
-		if(strlen($class = $this->getCssClass()) > 0)
613
+		if(strlen($class=$this->getCssClass()) > 0)
614 614
 			$writer->addAttribute('class', $class);
615 615
 		$writer->renderBeginTag('span');
616 616
 
617
-		$date = new \DateTime;
617
+		$date=new \DateTime;
618 618
 		$date->setTimeStamp($this->getTimeStampFromText());
619 619
 		$this->renderCalendarSelections($writer, $date);
620 620
 
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
 
631 631
 	protected function hasDayPattern()
632 632
 	{
633
-		$formatter = new TSimpleDateFormatter($this->getDateFormat());
634
-		return ($formatter->getDayPattern() !== null);
633
+		$formatter=new TSimpleDateFormatter($this->getDateFormat());
634
+		return ($formatter->getDayPattern()!==null);
635 635
 	}
636 636
 
637 637
 	/**
@@ -641,15 +641,15 @@  discard block
 block discarded – undo
641 641
 	 */
642 642
 	protected function renderCalendarSelections($writer, $date)
643 643
 	{
644
-		$formatter = new TSimpleDateFormatter($this->getDateFormat());
644
+		$formatter=new TSimpleDateFormatter($this->getDateFormat());
645 645
 
646 646
 		foreach($formatter->getDayMonthYearOrdering() as $type)
647 647
 		{
648
-			if($type == 'day')
648
+			if($type=='day')
649 649
 				$this->renderCalendarDayOptions($writer, $date->format('j'));
650
-			elseif($type == 'month')
650
+			elseif($type=='month')
651 651
 				$this->renderCalendarMonthOptions($writer, $date->format('n'));
652
-			elseif($type == 'year')
652
+			elseif($type=='year')
653 653
 				$this->renderCalendarYearOptions($writer, $date->format('Y'));
654 654
 		}
655 655
 	}
@@ -660,9 +660,9 @@  discard block
 block discarded – undo
660 660
 	 */
661 661
 	protected function getTimeStampFromText()
662 662
 	{
663
-		$pattern = $this->getDateFormat();
664
-		$pattern = str_replace(['MMMM', 'MMM'], ['MM','MM'], $pattern);
665
-		$formatter = new TSimpleDateFormatter($pattern);
663
+		$pattern=$this->getDateFormat();
664
+		$pattern=str_replace(['MMMM', 'MMM'], ['MM', 'MM'], $pattern);
665
+		$formatter=new TSimpleDateFormatter($pattern);
666 666
 		return $formatter->parse($this->getText());
667 667
 	}
668 668
 
@@ -672,12 +672,12 @@  discard block
 block discarded – undo
672 672
 	 * @param array list of selection options
673 673
 	 * @param mixed selected key.
674 674
 	 */
675
-	private function renderDropDownListOptions($writer, $options, $selected = null)
675
+	private function renderDropDownListOptions($writer, $options, $selected=null)
676 676
 	{
677 677
 		foreach($options as $k => $v)
678 678
 		{
679 679
 			$writer->addAttribute('value', $k);
680
-			if($k == $selected)
680
+			if($k==$selected)
681 681
 				$writer->addAttribute('selected', 'selected');
682 682
 			$writer->renderBeginTag('option');
683 683
 			$writer->write($v);
@@ -690,11 +690,11 @@  discard block
 block discarded – undo
690 690
 	 * @param THtmlWriter the writer used for the rendering purpose
691 691
 	 * @param mixed selected day.
692 692
 	 */
693
-	protected function renderCalendarDayOptions($writer, $selected = null)
693
+	protected function renderCalendarDayOptions($writer, $selected=null)
694 694
 	{
695
-		$days = $this->getDropDownDayOptions();
696
-		$writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'day');
697
-		$writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'day');
695
+		$days=$this->getDropDownDayOptions();
696
+		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'day');
697
+		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'day');
698 698
 		$writer->addAttribute('class', 'datepicker_day_options');
699 699
 		if($this->getReadOnly() || !$this->getEnabled(true))
700 700
 			$writer->addAttribute('disabled', 'disabled');
@@ -708,12 +708,12 @@  discard block
 block discarded – undo
708 708
 	 */
709 709
 	protected function getDropDownDayOptions()
710 710
 	{
711
-		$formatter = new TSimpleDateFormatter($this->getDateFormat());
712
-		$days = [];
713
-		$requiresPadding = $formatter->getDayPattern() === 'dd';
714
-		for($i = 1;$i <= 31;$i++)
711
+		$formatter=new TSimpleDateFormatter($this->getDateFormat());
712
+		$days=[];
713
+		$requiresPadding=$formatter->getDayPattern()==='dd';
714
+		for($i=1; $i <= 31; $i++)
715 715
 		{
716
-			$days[$i] = $requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i;
716
+			$days[$i]=$requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i;
717 717
 		}
718 718
 		return $days;
719 719
 	}
@@ -723,11 +723,11 @@  discard block
 block discarded – undo
723 723
 	 * @param THtmlWriter the writer used for the rendering purpose
724 724
 	 * @param mixed selected month.
725 725
 	 */
726
-	protected function renderCalendarMonthOptions($writer, $selected = null)
726
+	protected function renderCalendarMonthOptions($writer, $selected=null)
727 727
 	{
728
-		$info = $this->getLocalizedCalendarInfo();
729
-		$writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'month');
730
-		$writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'month');
728
+		$info=$this->getLocalizedCalendarInfo();
729
+		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'month');
730
+		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'month');
731 731
 		$writer->addAttribute('class', 'datepicker_month_options');
732 732
 		if($this->getReadOnly() || !$this->getEnabled(true))
733 733
 			$writer->addAttribute('disabled', 'disabled');
@@ -746,17 +746,17 @@  discard block
 block discarded – undo
746 746
 	 */
747 747
 	protected function getLocalizedMonthNames($info)
748 748
 	{
749
-		$formatter = new TSimpleDateFormatter($this->getDateFormat());
749
+		$formatter=new TSimpleDateFormatter($this->getDateFormat());
750 750
 		switch($formatter->getMonthPattern())
751 751
 		{
752 752
 			case 'MMM': return $info->getAbbreviatedMonthNames();
753 753
 			case 'MM':
754
-				$array = [];
755
-				for($i = 1;$i <= 12;$i++)
756
-						$array[$i - 1] = $i < 10 ? '0' . $i : $i;
754
+				$array=[];
755
+				for($i=1; $i <= 12; $i++)
756
+						$array[$i - 1]=$i < 10 ? '0'.$i : $i;
757 757
 				return $array;
758 758
 			case 'M':
759
-				$array = []; for($i = 1;$i <= 12;$i++) $array[$i - 1] = $i;
759
+				$array=[]; for($i=1; $i <= 12; $i++) $array[$i - 1]=$i;
760 760
 				return $array;
761 761
 			default :	return $info->getMonthNames();
762 762
 		}
@@ -767,13 +767,13 @@  discard block
 block discarded – undo
767 767
 	 * @param THtmlWriter the writer used for the rendering purpose
768 768
 	 * @param mixed selected year.
769 769
 	 */
770
-	protected function renderCalendarYearOptions($writer, $selected = null)
770
+	protected function renderCalendarYearOptions($writer, $selected=null)
771 771
 	{
772
-		$years = [];
773
-		for($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++)
774
-			$years[$i] = $i;
775
-		$writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'year');
776
-		$writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'year');
772
+		$years=[];
773
+		for($i=$this->getFromYear(); $i <= $this->getUpToYear(); $i++)
774
+			$years[$i]=$i;
775
+		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'year');
776
+		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'year');
777 777
 		$writer->addAttribute('class', 'datepicker_year_options');
778 778
 		if($this->getReadOnly() || !$this->getEnabled(true))
779 779
 			$writer->addAttribute('disabled', 'disabled');
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 	 */
789 789
 	protected function getDatePickerButtonID()
790 790
 	{
791
-		return $this->getClientID() . 'button';
791
+		return $this->getClientID().'button';
792 792
 	}
793 793
 
794 794
 	/**
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	{
800 800
 		$writer->addAttribute('id', $this->getDatePickerButtonID());
801 801
 		$writer->addAttribute('type', 'button');
802
-		$writer->addAttribute('class', $this->getCssClass() . ' TDatePickerButton');
802
+		$writer->addAttribute('class', $this->getCssClass().' TDatePickerButton');
803 803
 		$writer->addAttribute('value', $this->getButtonText());
804 804
 		if(!$this->getEnabled(true))
805 805
 			$writer->addAttribute('disabled', 'disabled');
@@ -813,12 +813,12 @@  discard block
 block discarded – undo
813 813
 	 */
814 814
 	 protected function renderImageButtonDatePicker($writer)
815 815
 	{
816
-		$url = $this->getButtonImageUrl();
817
-		$url = empty($url) ? $this->getAssetUrl('calendar.png') : $url;
816
+		$url=$this->getButtonImageUrl();
817
+		$url=empty($url) ? $this->getAssetUrl('calendar.png') : $url;
818 818
 		$writer->addAttribute('id', $this->getDatePickerButtonID());
819 819
 		$writer->addAttribute('src', $url);
820 820
 		$writer->addAttribute('alt', ' ');
821
-		$writer->addAttribute('class', $this->getCssClass() . ' TDatePickerImageButton');
821
+		$writer->addAttribute('class', $this->getCssClass().' TDatePickerImageButton');
822 822
 		if(!$this->getEnabled(true))
823 823
 			$writer->addAttribute('disabled', 'disabled');
824 824
 		$writer->addAttribute('type', 'image');
@@ -831,10 +831,10 @@  discard block
 block discarded – undo
831 831
 	 * @param string date picker asset file in the self::SCRIPT_PATH directory.
832 832
 	 * @return string date picker asset url.
833 833
 	 */
834
-	protected function getAssetUrl($file = '')
834
+	protected function getAssetUrl($file='')
835 835
 	{
836
-		$base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
837
-		return $base . '/' . self::SCRIPT_PATH . '/' . $file;
836
+		$base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl();
837
+		return $base.'/'.self::SCRIPT_PATH.'/'.$file;
838 838
 	}
839 839
 
840 840
 	/**
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
 	 */
844 844
 	protected function publishCalendarStyle()
845 845
 	{
846
-		$url = $this->getAssetUrl($this->getCalendarStyle() . '.css');
847
-		$cs = $this->getPage()->getClientScript();
846
+		$url=$this->getAssetUrl($this->getCalendarStyle().'.css');
847
+		$cs=$this->getPage()->getClientScript();
848 848
 		if(!$cs->isStyleSheetFileRegistered($url))
849 849
 			$cs->registerStyleSheetFile($url, $url);
850 850
 		return $url;
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 	{
868 868
 		if($this->getShowCalendar())
869 869
 		{
870
-			$cs = $this->getPage()->getClientScript();
870
+			$cs=$this->getPage()->getClientScript();
871 871
 			$cs->registerPradoScript("datepicker");
872 872
 		}
873 873
 	}
@@ -876,17 +876,17 @@  discard block
 block discarded – undo
876 876
 	{
877 877
 		if($this->getShowCalendar())
878 878
 		{
879
-			$cs = $this->getPage()->getClientScript();
879
+			$cs=$this->getPage()->getClientScript();
880 880
 			if(!$cs->isEndScriptRegistered('TDatePicker.spacer'))
881 881
 			{
882
-				$spacer = $this->getAssetUrl('spacer.gif');
883
-				$code = "Prado.WebUI.TDatePicker.spacer = '$spacer';";
882
+				$spacer=$this->getAssetUrl('spacer.gif');
883
+				$code="Prado.WebUI.TDatePicker.spacer = '$spacer';";
884 884
 				$cs->registerEndScript('TDatePicker.spacer', $code);
885 885
 			}
886 886
 
887
-			$options = TJavaScript::encode($this->getDatePickerOptions());
888
-			$code = "new Prado.WebUI.TDatePicker($options);";
889
-			$cs->registerEndScript("prado:" . $this->getClientID(), $code);
887
+			$options=TJavaScript::encode($this->getDatePickerOptions());
888
+			$code="new Prado.WebUI.TDatePicker($options);";
889
+			$cs->registerEndScript("prado:".$this->getClientID(), $code);
890 890
 		}
891 891
 	}
892 892
 }
893 893
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TLiteral.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,8 +106,7 @@
 block discarded – undo
106 106
 				$writer->write(THttpUtility::htmlEncode($text));
107 107
 			else
108 108
 				$writer->write($text);
109
-		}
110
-		else
109
+		} else
111 110
 			parent::render($writer);
112 111
 	}
113 112
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
 	 */
102 102
 	public function render($writer)
103 103
 	{
104
-		if(($text = $this->getText()) !== '')
104
+		if(($text=$this->getText())!=='')
105 105
 		{
106 106
 			if($this->getEncode())
107 107
 				$writer->write(THttpUtility::htmlEncode($text));
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/THyperLink.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,8 +72,7 @@
 block discarded – undo
72 72
 				parent::renderContents($writer);
73 73
 			else
74 74
 				$writer->write(THttpUtility::htmlEncode($this->getNavigateUrl()));
75
-		}
76
-		else
75
+		} else
77 76
 		{
78 77
 			$this->createImage($imageUrl)->renderControl($writer);
79 78
 		}
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function addAttributesToRender($writer)
51 51
 	{
52
-		$isEnabled = $this->getEnabled(true);
52
+		$isEnabled=$this->getEnabled(true);
53 53
 		if($this->getEnabled() && !$isEnabled)
54 54
 			$writer->addAttribute('disabled', 'disabled');
55 55
 		parent::addAttributesToRender($writer);
56
-		if(($url = $this->getNavigateUrl()) !== '' && $isEnabled)
56
+		if(($url=$this->getNavigateUrl())!=='' && $isEnabled)
57 57
 			$writer->addAttribute('href', $url);
58
-		if(($target = $this->getTarget()) !== '')
58
+		if(($target=$this->getTarget())!=='')
59 59
 			$writer->addAttribute('target', $target);
60 60
 	}
61 61
 
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function renderContents($writer)
67 67
 	{
68
-		if(($imageUrl = $this->getImageUrl()) === '')
68
+		if(($imageUrl=$this->getImageUrl())==='')
69 69
 		{
70
-			if(($text = $this->getText()) !== '')
70
+			if(($text=$this->getText())!=='')
71 71
 				$writer->write(THttpUtility::htmlEncode($text));
72 72
 			elseif($this->getHasControls())
73 73
 				parent::renderContents($writer);
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	protected function createImage($imageUrl)
90 90
 	{
91
-		$image = new TImage;
91
+		$image=new TImage;
92 92
 		$image->setImageUrl($imageUrl);
93
-		if(($width = $this->getImageWidth()) !== '')
93
+		if(($width=$this->getImageWidth())!=='')
94 94
 			$image->setWidth($width);
95
-		if(($height = $this->getImageHeight()) !== '')
95
+		if(($height=$this->getImageHeight())!=='')
96 96
 			$image->setHeight($height);
97
-		if(($toolTip = $this->getToolTip()) !== '')
97
+		if(($toolTip=$this->getToolTip())!=='')
98 98
 			$image->setToolTip($toolTip);
99
-		if(($text = $this->getText()) !== '')
99
+		if(($text=$this->getText())!=='')
100 100
 			$image->setAlternateText($text);
101
-		if(($align = $this->getImageAlign()) !== '')
101
+		if(($align=$this->getImageAlign())!=='')
102 102
 			$image->setImageAlign($align);
103 103
 		$image->setBorderWidth('0');
104 104
 		return $image;
Please login to merge, or discard this patch.
framework/Web/UI/JuiControls/TJuiAutoCompleteTemplate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
 	public function __construct($template)
30 30
 	{
31
-		$this->_template = $template;
31
+		$this->_template=$template;
32 32
 	}
33 33
 	/**
34 34
 	 * Instantiates the template.
Please login to merge, or discard this patch.
framework/Web/UI/TForm.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,7 @@
 block discarded – undo
92 92
 
93 93
 			$cs->renderScriptFilesEnd($writer);
94 94
 			$cs->renderEndScripts($writer);
95
-		}
96
-		else
95
+		} else
97 96
 		{
98 97
 			$cs->renderHiddenFieldsBegin($writer);
99 98
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 	{
51 51
 		$writer->addAttribute('id', $this->getClientID());
52 52
 		$writer->addAttribute('method', $this->getMethod());
53
-		$uri = $this->getRequest()->getRequestURI();
53
+		$uri=$this->getRequest()->getRequestURI();
54 54
 		$writer->addAttribute('action', str_replace('&', '&amp;', str_replace('&amp;', '&', $uri)));
55
-		if(($enctype = $this->getEnctype()) !== '')
55
+		if(($enctype=$this->getEnctype())!=='')
56 56
 			$writer->addAttribute('enctype', $enctype);
57 57
 
58
-		$attributes = $this->getAttributes();
58
+		$attributes=$this->getAttributes();
59 59
 		$attributes->remove('action');
60 60
 		$writer->addAttributes($attributes);
61 61
 
62
-		if(($butt = $this->getDefaultButton()) !== '')
62
+		if(($butt=$this->getDefaultButton())!=='')
63 63
 		{
64
-			if(($button = $this->findControl($butt)) !== null)
64
+			if(($button=$this->findControl($butt))!==null)
65 65
 				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
66 66
 			else
67 67
 				throw new TInvalidDataValueException('form_defaultbutton_invalid', $butt);
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function render($writer)
76 76
 	{
77
-		$page = $this->getPage();
77
+		$page=$this->getPage();
78 78
 
79 79
 		$this->addAttributesToRender($writer);
80 80
 		$writer->renderBeginTag('form');
81 81
 
82
-		$cs = $page->getClientScript();
82
+		$cs=$page->getClientScript();
83 83
 		if($page->getClientSupportsJavaScript())
84 84
 		{
85 85
 			$cs->renderHiddenFieldsBegin($writer);
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveImageButton.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -48,6 +48,7 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * Sets the alternative text to be displayed in the TImage when the image is unavailable.
50 50
 	 * @param string the alternative text
51
+	 * @param string $value
51 52
 	 */
52 53
 	public function setAlternateText($value)
53 54
 	{
@@ -78,6 +79,7 @@  discard block
 block discarded – undo
78 79
 
79 80
 	/**
80 81
 	 * @param string the URL of the image file
82
+	 * @param string $value
81 83
 	 */
82 84
 	public function setImageUrl($value)
83 85
 	{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function setAlternateText($value)
50 50
 	{
51
-		if(parent::getAlternateText() === $value)
51
+		if(parent::getAlternateText()===$value)
52 52
 			return;
53 53
 
54 54
 		parent::setAlternateText($value);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function setImageAlign($value)
67 67
 	{
68
-		if(parent::getImageAlign() === $value)
68
+		if(parent::getImageAlign()===$value)
69 69
 			return;
70 70
 
71 71
 		parent::setImageAlign($value);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function setImageUrl($value)
80 80
 	{
81
-		if(parent::getImageUrl() === $value)
81
+		if(parent::getImageUrl()===$value)
82 82
 			return;
83 83
 
84 84
 		parent::setImageUrl($value);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function setDescriptionUrl($value)
93 93
 	{
94
-		if(parent::getDescriptionUrl() === $value)
94
+		if(parent::getDescriptionUrl()===$value)
95 95
 			return;
96 96
 
97 97
 		parent::setDescriptionUrl($value);
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/THiddenField.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@
 block discarded – undo
125 125
 	/**
126 126
 	 * Returns the value to be validated.
127 127
 	 * This methid is required by \Prado\Web\UI\IValidatable interface.
128
-	 * @return mixed the value of the property to be validated.
128
+	 * @return string the value of the property to be validated.
129 129
 	 */
130 130
 	public function getValidationPropertyValue()
131 131
 	{
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class THiddenField extends \Prado\Web\UI\TControl implements \Prado\Web\UI\IPostBackDataHandler, \Prado\Web\UI\IValidatable, \Prado\IDataRenderer
30 30
 {
31
-	private $_dataChanged = false;
32
-	private $_isValid = true;
31
+	private $_dataChanged=false;
32
+	private $_isValid=true;
33 33
 
34 34
 	/**
35 35
 	 * @return string tag name of the hidden field.
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function render($writer)
58 58
 	{
59
-		$uniqueID = $this->getUniqueID();
59
+		$uniqueID=$this->getUniqueID();
60 60
 		$this->getPage()->ensureRenderInForm($this);
61 61
 		$writer->addAttribute('type', 'hidden');
62
-		if($uniqueID !== '')
62
+		if($uniqueID!=='')
63 63
 			$writer->addAttribute('name', $uniqueID);
64
-		if($this->getID() !== '')
64
+		if($this->getID()!=='')
65 65
 			$writer->addAttribute('id', $this->getClientID());
66
-		if(($value = $this->getValue()) !== '')
66
+		if(($value=$this->getValue())!=='')
67 67
 			$writer->addAttribute('value', $value);
68 68
 
69 69
 		if($this->getHasAttributes())
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function loadPostData($key, $values)
87 87
 	{
88
-		$value = $values[$key];
89
-		if($value === $this->getValue())
88
+		$value=$values[$key];
89
+		if($value===$this->getValue())
90 90
 			return false;
91 91
 		else
92 92
 		{
93 93
 			$this->setValue($value);
94
-			return $this->_dataChanged = true;
94
+			return $this->_dataChanged=true;
95 95
 		}
96 96
 	}
97 97
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function setIsValid($value)
131 131
 	{
132
-		$this->_isValid = TPropertyValue::ensureBoolean($value);
132
+		$this->_isValid=TPropertyValue::ensureBoolean($value);
133 133
 	}
134 134
 
135 135
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TListBox.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@
 block discarded – undo
125 125
 	/**
126 126
 	 * Returns the value to be validated.
127 127
 	 * This methid is required by \Prado\Web\UI\IValidatable interface.
128
-	 * @return mixed the value of the property to be validated.
128
+	 * @return string the value of the property to be validated.
129 129
 	 */
130 130
 	public function getValidationPropertyValue()
131 131
 	{
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class TListBox extends TListControl implements \Prado\Web\UI\IPostBackDataHandler, \Prado\Web\UI\IValidatable
37 37
 {
38
-	private $_dataChanged = false;
39
-	private $_isValid = true;
38
+	private $_dataChanged=false;
39
+	private $_isValid=true;
40 40
 
41 41
 	/**
42 42
 	 * Adds attribute name-value pairs to renderer.
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	protected function addAttributesToRender($writer)
47 47
 	{
48
-		$rows = $this->getRows();
48
+		$rows=$this->getRows();
49 49
 		$writer->addAttribute('size', "$rows");
50
-		if($this->getSelectionMode() === TListSelectionMode::Multiple)
51
-			$writer->addAttribute('name', $this->getUniqueID() . '[]');
50
+		if($this->getSelectionMode()===TListSelectionMode::Multiple)
51
+			$writer->addAttribute('name', $this->getUniqueID().'[]');
52 52
 		else
53 53
 			$writer->addAttribute('name', $this->getUniqueID());
54 54
 		parent::addAttributesToRender($writer);
@@ -88,55 +88,55 @@  discard block
 block discarded – undo
88 88
 		if(!$this->getEnabled(true))
89 89
 			return false;
90 90
 		$this->ensureDataBound();
91
-		$selections = isset($values[$key])?$values[$key]:null;
92
-		if($selections !== null)
91
+		$selections=isset($values[$key]) ? $values[$key] : null;
92
+		if($selections!==null)
93 93
 		{
94
-			$items = $this->getItems();
95
-			if($this->getSelectionMode() === TListSelectionMode::Single)
94
+			$items=$this->getItems();
95
+			if($this->getSelectionMode()===TListSelectionMode::Single)
96 96
 			{
97
-				$selection = is_array($selections)?$selections[0]:$selections;
98
-				$index = $items->findIndexByValue($selection, false);
99
-				if($this->getSelectedIndex() !== $index)
97
+				$selection=is_array($selections) ? $selections[0] : $selections;
98
+				$index=$items->findIndexByValue($selection, false);
99
+				if($this->getSelectedIndex()!==$index)
100 100
 				{
101 101
 					$this->setSelectedIndex($index);
102
-					return $this->_dataChanged = true;
102
+					return $this->_dataChanged=true;
103 103
 				}
104 104
 				else
105 105
 					return false;
106 106
 			}
107 107
 			if(!is_array($selections))
108
-				$selections = [$selections];
109
-			$list = [];
108
+				$selections=[$selections];
109
+			$list=[];
110 110
 			foreach($selections as $selection)
111
-				$list[] = $items->findIndexByValue($selection, false);
112
-			$list2 = $this->getSelectedIndices();
113
-			$n = count($list);
114
-			$flag = false;
115
-			if($n === count($list2))
111
+				$list[]=$items->findIndexByValue($selection, false);
112
+			$list2=$this->getSelectedIndices();
113
+			$n=count($list);
114
+			$flag=false;
115
+			if($n===count($list2))
116 116
 			{
117 117
 				sort($list, SORT_NUMERIC);
118
-				for($i = 0;$i < $n;++$i)
118
+				for($i=0; $i < $n; ++$i)
119 119
 				{
120
-					if($list[$i] !== $list2[$i])
120
+					if($list[$i]!==$list2[$i])
121 121
 					{
122
-						$flag = true;
122
+						$flag=true;
123 123
 						break;
124 124
 					}
125 125
 				}
126 126
 			}
127 127
 			else
128
-				$flag = true;
128
+				$flag=true;
129 129
 			if($flag)
130 130
 			{
131 131
 				$this->setSelectedIndices($list);
132
-				$this->_dataChanged = true;
132
+				$this->_dataChanged=true;
133 133
 			}
134 134
 			return $flag;
135 135
 		}
136
-		elseif($this->getSelectedIndex() !== -1)
136
+		elseif($this->getSelectedIndex()!==-1)
137 137
 		{
138 138
 			$this->clearSelection();
139
-			return $this->_dataChanged = true;
139
+			return $this->_dataChanged=true;
140 140
 		}
141 141
 		else
142 142
 			return false;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	protected function getIsMultiSelect()
173 173
 	{
174
-		return $this->getSelectionMode() === TListSelectionMode::Multiple;
174
+		return $this->getSelectionMode()===TListSelectionMode::Multiple;
175 175
 	}
176 176
 
177 177
 	/**
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function setRows($value)
189 189
 	{
190
-		$value = TPropertyValue::ensureInteger($value);
190
+		$value=TPropertyValue::ensureInteger($value);
191 191
 		if($value <= 0)
192
-			$value = 4;
192
+			$value=4;
193 193
 		$this->setViewState('Rows', $value, 4);
194 194
 	}
195 195
 
@@ -233,6 +233,6 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function setIsValid($value)
235 235
 	{
236
-		$this->_isValid = TPropertyValue::ensureBoolean($value);
236
+		$this->_isValid=TPropertyValue::ensureBoolean($value);
237 237
 	}
238 238
 }
239 239
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -100,8 +100,7 @@  discard block
 block discarded – undo
100 100
 				{
101 101
 					$this->setSelectedIndex($index);
102 102
 					return $this->_dataChanged = true;
103
-				}
104
-				else
103
+				} else
105 104
 					return false;
106 105
 			}
107 106
 			if(!is_array($selections))
@@ -123,8 +122,7 @@  discard block
 block discarded – undo
123 122
 						break;
124 123
 					}
125 124
 				}
126
-			}
127
-			else
125
+			} else
128 126
 				$flag = true;
129 127
 			if($flag)
130 128
 			{
@@ -132,13 +130,11 @@  discard block
 block discarded – undo
132 130
 				$this->_dataChanged = true;
133 131
 			}
134 132
 			return $flag;
135
-		}
136
-		elseif($this->getSelectedIndex() !== -1)
133
+		} elseif($this->getSelectedIndex() !== -1)
137 134
 		{
138 135
 			$this->clearSelection();
139 136
 			return $this->_dataChanged = true;
140
-		}
141
-		else
137
+		} else
142 138
 			return false;
143 139
 	}
144 140
 
Please login to merge, or discard this patch.
framework/I18N/core/MessageSource_PHP.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -246,6 +246,9 @@  discard block
 block discarded – undo
246 246
 		return false;
247 247
 	}
248 248
 
249
+	/**
250
+	 * @param string $filename
251
+	 */
249 252
 	protected function internalSaveFile($php, $filename, $variant)
250 253
 	{
251 254
 		$php['info']['date'] = @date('Y-m-d\TH:i:s\Z');
@@ -377,6 +380,9 @@  discard block
 block discarded – undo
377 380
 		return false;
378 381
 	}
379 382
 
383
+	/**
384
+	 * @param string $catalogue
385
+	 */
380 386
 	protected function createMessageTemplate($catalogue)
381 387
 	{
382 388
 		if($catalogue === null) {
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 	 * Message data filename extension.
41 41
 	 * @var string
42 42
 	 */
43
-	protected $dataExt = '.php';
43
+	protected $dataExt='.php';
44 44
 
45 45
 	/**
46 46
 	 * Separator between culture name and source.
47 47
 	 * @var string
48 48
 	 */
49
-	protected $dataSeparator = '.';
49
+	protected $dataSeparator='.';
50 50
 
51 51
 	/**
52 52
 	 * Constructor.
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function __construct($source)
57 57
 	{
58
-		$this->source = (string)$source;
58
+		$this->source=(string) $source;
59 59
 	}
60 60
 
61 61
 	/**
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
 	protected function &loadData($filename)
67 67
 	{
68 68
 		//load it.
69
-		if(false === ($php = include($filename))) {
69
+		if(false===($php=include($filename))) {
70 70
 			return false;
71 71
 		}
72 72
 
73
-		$translationUnit = $php['trans-unit'];
73
+		$translationUnit=$php['trans-unit'];
74 74
 
75
-		$translations = [];
75
+		$translations=[];
76 76
 
77 77
 		foreach($translationUnit as $k => $unit)
78 78
 		{
79
-			$source = (string)$unit['source'];
80
-			$translations[$source][] = (string)$unit['target'];
81
-			$translations[$source][] = (string)$k;
82
-			$translations[$source][] = array_key_exists('note', $unit) ? (string)$unit['note'] : '';
79
+			$source=(string) $unit['source'];
80
+			$translations[$source][]=(string) $unit['target'];
81
+			$translations[$source][]=(string) $k;
82
+			$translations[$source][]=array_key_exists('note', $unit) ? (string) $unit['note'] : '';
83 83
 		}
84 84
 
85 85
 		return $translations;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	protected function getSource($variant)
106 106
 	{
107
-		return $this->source . '/' . $variant;
107
+		return $this->source.'/'.$variant;
108 108
 	}
109 109
 
110 110
 	/**
@@ -124,21 +124,21 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	protected function getCatalogueList($catalogue)
126 126
 	{
127
-		$variants = explode('_', $this->culture);
128
-		$source = $catalogue . $this->dataExt;
129
-		$catalogues = [$source];
130
-		$variant = null;
127
+		$variants=explode('_', $this->culture);
128
+		$source=$catalogue.$this->dataExt;
129
+		$catalogues=[$source];
130
+		$variant=null;
131 131
 
132
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
132
+		for($i=0, $k=count($variants); $i < $k; ++$i)
133 133
 		{
134 134
 			if(isset($variants[$i]{0}))
135 135
 			{
136
-				$variant .= ($variant)?'_' . $variants[$i]:$variants[$i];
137
-				$catalogues[] = $catalogue . $this->dataSeparator . $variant . $this->dataExt;
136
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
137
+				$catalogues[]=$catalogue.$this->dataSeparator.$variant.$this->dataExt;
138 138
 			}
139 139
 		}
140 140
 
141
-		$byDir = $this->getCatalogueByDir($catalogue);
141
+		$byDir=$this->getCatalogueByDir($catalogue);
142 142
 		return array_merge($byDir, array_reverse($catalogues));
143 143
 	}
144 144
 
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	private function getCatalogueByDir($catalogue)
153 153
 	{
154
-		$variants = explode('_', $this->culture);
155
-		$catalogues = [];
156
-		$variant = null;
154
+		$variants=explode('_', $this->culture);
155
+		$catalogues=[];
156
+		$variant=null;
157 157
 
158
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
158
+		for($i=0, $k=count($variants); $i < $k; ++$i)
159 159
 		{
160 160
 			if(isset($variants[$i]{0}))
161 161
 			{
162
-				$variant .= ($variant)?'_' . $variants[$i]:$variants[$i];
163
-				$catalogues[] = $variant . '/' . $catalogue . $this->dataExt;
162
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
163
+				$catalogues[]=$variant.'/'.$catalogue.$this->dataExt;
164 164
 			}
165 165
 		}
166 166
 
@@ -184,38 +184,38 @@  discard block
 block discarded – undo
184 184
 	 * E.g. array('messages','en_AU')
185 185
 	 * @return array list of catalogues
186 186
 	 */
187
-	protected function getCatalogues($dir = null, $variant = null)
187
+	protected function getCatalogues($dir=null, $variant=null)
188 188
 	{
189
-		$dir = $dir?$dir:$this->source;
190
-		$files = scandir($dir);
191
-		$catalogue = [];
189
+		$dir=$dir ? $dir : $this->source;
190
+		$files=scandir($dir);
191
+		$catalogue=[];
192 192
 
193 193
 		foreach($files as $file)
194 194
 		{
195
-			if(is_dir($dir . '/' . $file) && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file)) {
196
-				$catalogue = array_merge(
195
+			if(is_dir($dir.'/'.$file) && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file)) {
196
+				$catalogue=array_merge(
197 197
 					$catalogue,
198
-					$this->getCatalogues($dir . '/' . $file, $file)
198
+					$this->getCatalogues($dir.'/'.$file, $file)
199 199
 				);
200 200
 			}
201 201
 
202
-			$pos = strpos($file, $this->dataExt);
203
-			if($pos > 0 && substr($file, -1 * strlen($this->dataExt)) == $this->dataExt)
202
+			$pos=strpos($file, $this->dataExt);
203
+			if($pos > 0 && substr($file, -1 * strlen($this->dataExt))==$this->dataExt)
204 204
 			{
205
-				$name = substr($file, 0, $pos);
206
-				$dot = strrpos($name, $this->dataSeparator);
207
-				$culture = $variant;
208
-				$cat = $name;
205
+				$name=substr($file, 0, $pos);
206
+				$dot=strrpos($name, $this->dataSeparator);
207
+				$culture=$variant;
208
+				$cat=$name;
209 209
 
210 210
 				if(is_int($dot))
211 211
 				{
212
-					$culture = substr($name, $dot + 1, strlen($name));
213
-					$cat = substr($name, 0, $dot);
212
+					$culture=substr($name, $dot + 1, strlen($name));
213
+					$cat=substr($name, 0, $dot);
214 214
 				}
215 215
 
216
-				$details[0] = $cat;
217
-				$details[1] = $culture;
218
-				$catalogue[] = $details;
216
+				$details[0]=$cat;
217
+				$details[1]=$culture;
218
+				$catalogue[]=$details;
219 219
 			}
220 220
 		}
221 221
 		sort($catalogue);
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
 	 * @see update()
231 231
 	 * @see delete()
232 232
 	 */
233
-	private function getVariants($catalogue = 'messages')
233
+	private function getVariants($catalogue='messages')
234 234
 	{
235
-		if($catalogue === null) {
236
-			$catalogue = 'messages';
235
+		if($catalogue===null) {
236
+			$catalogue='messages';
237 237
 		}
238 238
 
239 239
 		foreach($this->getCatalogueList($catalogue) as $variant)
240 240
 		{
241
-			$file = $this->getSource($variant);
241
+			$file=$this->getSource($variant);
242 242
 			if(is_file($file)) {
243 243
 				return [$variant, $file];
244 244
 			}
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 
249 249
 	protected function internalSaveFile($php, $filename, $variant)
250 250
 	{
251
-		$php['info']['date'] = @date('Y-m-d\TH:i:s\Z');
251
+		$php['info']['date']=@date('Y-m-d\TH:i:s\Z');
252 252
 
253 253
 		//save it and clear the cache for this variant
254
-		if(false === file_put_contents($filename, "<?php\nreturn " . var_export($php, true) . ';'))
254
+		if(false===file_put_contents($filename, "<?php\nreturn ".var_export($php, true).';'))
255 255
 			return false;
256 256
 
257 257
 		if(!empty($this->cache))
@@ -267,32 +267,32 @@  discard block
 block discarded – undo
267 267
 	 * @param string the catalogue to add to
268 268
 	 * @return boolean true if saved successfuly, false otherwise.
269 269
 	 */
270
-	public function save($catalogue = 'messages')
270
+	public function save($catalogue='messages')
271 271
 	{
272
-		$messages = $this->untranslated;
272
+		$messages=$this->untranslated;
273 273
 		if(count($messages) <= 0) {
274 274
 			return false;
275 275
 		}
276 276
 
277
-		$variants = $this->getVariants($catalogue);
277
+		$variants=$this->getVariants($catalogue);
278 278
 
279 279
 		if($variants) {
280
-			list($variant, $filename) = $variants;
280
+			list($variant, $filename)=$variants;
281 281
 		} else {
282
-			list($variant, $filename) = $this->createMessageTemplate($catalogue);
282
+			list($variant, $filename)=$this->createMessageTemplate($catalogue);
283 283
 		}
284 284
 
285
-		if(is_writable($filename) == false) {
285
+		if(is_writable($filename)==false) {
286 286
 			throw new TIOException("Unable to save to file {$filename}, file must be writable.");
287 287
 		}
288 288
 
289 289
 		//import the existing php file
290
-		$php = include($filename);
290
+		$php=include($filename);
291 291
 
292 292
 		//for each message add it to the XML file using DOM
293 293
 		foreach($messages as $message)
294 294
 		{
295
-			$php['trans-unit'][] = [
295
+			$php['trans-unit'][]=[
296 296
 				'source' => $message,
297 297
 				'target' => '',
298 298
 			];
@@ -309,31 +309,31 @@  discard block
 block discarded – undo
309 309
 	 * @param string the catalogue to save to.
310 310
 	 * @return boolean true if translation was updated, false otherwise.
311 311
 	 */
312
-	public function update($text, $target, $comments, $catalogue = 'messages')
312
+	public function update($text, $target, $comments, $catalogue='messages')
313 313
 	{
314
-		$variants = $this->getVariants($catalogue);
314
+		$variants=$this->getVariants($catalogue);
315 315
 
316 316
 		if($variants) {
317
-			list($variant, $filename) = $variants;
317
+			list($variant, $filename)=$variants;
318 318
 		} else {
319 319
 			return false;
320 320
 		}
321 321
 
322
-		if(is_writable($filename) == false) {
322
+		if(is_writable($filename)==false) {
323 323
 			throw new TIOException("Unable to update file {$filename}, file must be writable.");
324 324
 		}
325 325
 
326 326
 		//import the existing php file
327
-		$php = include($filename);
327
+		$php=include($filename);
328 328
 
329 329
 		//for each of the existin units
330 330
 		foreach($php['trans-unit'] as $k => $unit)
331 331
 		{
332
-			if($unit['source'] == $text)
332
+			if($unit['source']==$text)
333 333
 			{
334
-				$php['trans-unit'][$k]['target'] = $target;
334
+				$php['trans-unit'][$k]['target']=$target;
335 335
 				if(!empty($comments))
336
-					$php['trans-unit'][$k]['note'] = $comments;
336
+					$php['trans-unit'][$k]['note']=$comments;
337 337
 
338 338
 				break;
339 339
 			}
@@ -348,26 +348,26 @@  discard block
 block discarded – undo
348 348
 	 * @param string the catalogue to delete from.
349 349
 	 * @return boolean true if deleted, false otherwise.
350 350
 	 */
351
-	public function delete($message, $catalogue = 'messages')
351
+	public function delete($message, $catalogue='messages')
352 352
 	{
353
-		$variants = $this->getVariants($catalogue);
353
+		$variants=$this->getVariants($catalogue);
354 354
 		if($variants) {
355
-			list($variant, $filename) = $variants;
355
+			list($variant, $filename)=$variants;
356 356
 		} else {
357 357
 			return false;
358 358
 		}
359 359
 
360
-		if(is_writable($filename) == false) {
360
+		if(is_writable($filename)==false) {
361 361
 			throw new TIOException("Unable to modify file {$filename}, file must be writable.");
362 362
 		}
363 363
 
364 364
 		//import the existing php file
365
-		$php = include($filename);
365
+		$php=include($filename);
366 366
 
367 367
 		//for each of the existin units
368 368
 		foreach($php['trans-unit'] as $k => $unit)
369 369
 		{
370
-			if($unit['source'] == $message)
370
+			if($unit['source']==$message)
371 371
 			{
372 372
 				unset($php['trans-unit'][$k]);
373 373
 				return $this->internalSaveFile($php, $filename, $variant);
@@ -379,14 +379,14 @@  discard block
 block discarded – undo
379 379
 
380 380
 	protected function createMessageTemplate($catalogue)
381 381
 	{
382
-		if($catalogue === null) {
383
-			$catalogue = 'messages';
382
+		if($catalogue===null) {
383
+			$catalogue='messages';
384 384
 		}
385 385
 		
386
-		$variants = $this->getCatalogueList($catalogue);
387
-		$variant = array_shift($variants);
388
-		$file = $this->getSource($variant);
389
-		$dir = dirname($file);
386
+		$variants=$this->getCatalogueList($catalogue);
387
+		$variant=array_shift($variants);
388
+		$file=$this->getSource($variant);
389
+		$dir=dirname($file);
390 390
 
391 391
 		if(!is_dir($dir)) {
392 392
 			@mkdir($dir);
@@ -405,8 +405,8 @@  discard block
 block discarded – undo
405 405
 
406 406
 	protected function getTemplate($catalogue)
407 407
 	{
408
-		$date = @date('Y-m-d\TH:i:s\Z');
409
-		$php = <<<EOD
408
+		$date=@date('Y-m-d\TH:i:s\Z');
409
+		$php=<<<EOD
410 410
 <?php
411 411
 return array(
412 412
 	'info' => array(
Please login to merge, or discard this patch.