Passed
Pull Request — master (#2)
by tsms
01:48
created
src/Month/Weekdays.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      *
114 114
      * @access public
115 115
      */
116
-    function __construct($y, $m, $firstDay=null)
116
+    function __construct($y, $m, $firstDay = null)
117 117
     {
118 118
         parent::__construct($y, $m, $firstDay);
119 119
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     function buildEmptyDaysBefore()
152 152
     {
153 153
         $eBefore = $this->tableHelper->getEmptyDaysBefore();
154
-        for ($i=0; $i < $eBefore; $i++) {
154
+        for ($i = 0; $i < $eBefore; $i++) {
155 155
             $stamp = $this->cE->dateToStamp($this->year, $this->month, -$i);
156 156
             $Day = new Day(
157 157
                                 $this->cE->stampToYear($stamp),
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
     {
188 188
         $eAfter = $this->tableHelper->getEmptyDaysAfter();
189 189
         $sDOM   = $this->tableHelper->getNumTableDaysInMonth();
190
-        for ($i=1; $i <= $sDOM-$eAfter; $i++) {
191
-            $Day = new Day($this->year, $this->month+1, $i);
190
+        for ($i = 1; $i <= $sDOM - $eAfter; $i++) {
191
+            $Day = new Day($this->year, $this->month + 1, $i);
192 192
             $Day->setEmpty();
193 193
             $Day->adjust();
194 194
             array_push($this->children, $Day);
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
             $this->thisDay()
211 211
         );
212 212
         $sDOM = $this->tableHelper->getNumTableDaysInMonth();
213
-        for ($i=1; $i <= $sDOM; $i+= $dIW) {
213
+        for ($i = 1; $i <= $sDOM; $i += $dIW) {
214 214
             $this->children[$i]->setFirst();
215
-            $this->children[$i+($dIW-1)]->setLast();
215
+            $this->children[$i + ($dIW - 1)]->setLast();
216 216
         }
217 217
     }
218 218
 }
Please login to merge, or discard this patch.
src/Calendar.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
         if (defined('CALENDAR_FIRST_DAY_OF_WEEK')) {
492 492
             if (!is_null($firstDay) && ($firstDay != CALENDAR_FIRST_DAY_OF_WEEK)) {
493 493
                 $msg = 'CALENDAR_FIRST_DAY_OF_WEEK constant already defined.'
494
-                  .' The $firstDay parameter will be ignored.';
494
+                    .' The $firstDay parameter will be ignored.';
495 495
                 trigger_error($msg, E_USER_WARNING);
496 496
             }
497 497
             return CALENDAR_FIRST_DAY_OF_WEEK;
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
     }
715 715
 
716 716
     /**
717
-    * Returns the value for the next minute
718
-    *
717
+     * Returns the value for the next minute
718
+     *
719 719
      * @param string $format return value format ['int'|'timestamp'|'object'|'array']
720 720
      *
721 721
      * @return int e.g. 25 or timestamp
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
     /**
749 749
      * Returns the value for this second
750 750
      *
751
-    * @param string $format return value format ['int'|'timestamp'|'object'|'array']
752
-    *
751
+     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
752
+     *
753 753
      * @return int e.g. 44 or timestamp
754 754
      * @access public
755 755
      */
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 /**
55 55
  * Define Calendar Month states
56 56
  */
57
-define('CALENDAR_USE_MONTH',          1);
57
+define('CALENDAR_USE_MONTH', 1);
58 58
 define('CALENDAR_USE_MONTH_WEEKDAYS', 2);
59
-define('CALENDAR_USE_MONTH_WEEKS',    3);
59
+define('CALENDAR_USE_MONTH_WEEKS', 3);
60 60
 
61 61
 /**
62 62
  * Contains a factory method to return a Singleton instance of a class
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      * @return array
312 312
      * @access public
313 313
      */
314
-    function toArray($stamp=null)
314
+    function toArray($stamp = null)
315 315
     {
316 316
         if (is_null($stamp)) {
317 317
             $stamp = $this->getTimeStamp();
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
                 $this->thisDay()
504 504
             );
505 505
         }
506
-        define ('CALENDAR_FIRST_DAY_OF_WEEK', $firstDay);
506
+        define('CALENDAR_FIRST_DAY_OF_WEEK', $firstDay);
507 507
         return CALENDAR_FIRST_DAY_OF_WEEK;
508 508
     }
509 509
 
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
      */
518 518
     function prevYear($format = 'int')
519 519
     {
520
-        $ts = $this->cE->dateToStamp($this->year-1, 1, 1, 0, 0, 0);
521
-        return $this->returnValue('Year', $format, $ts, $this->year-1);
520
+        $ts = $this->cE->dateToStamp($this->year - 1, 1, 1, 0, 0, 0);
521
+        return $this->returnValue('Year', $format, $ts, $this->year - 1);
522 522
     }
523 523
 
524 524
     /**
@@ -545,8 +545,8 @@  discard block
 block discarded – undo
545 545
      */
546 546
     function nextYear($format = 'int')
547 547
     {
548
-        $ts = $this->cE->dateToStamp($this->year+1, 1, 1, 0, 0, 0);
549
-        return $this->returnValue('Year', $format, $ts, $this->year+1);
548
+        $ts = $this->cE->dateToStamp($this->year + 1, 1, 1, 0, 0, 0);
549
+        return $this->returnValue('Year', $format, $ts, $this->year + 1);
550 550
     }
551 551
 
552 552
     /**
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
      */
560 560
     function prevMonth($format = 'int')
561 561
     {
562
-        $ts = $this->cE->dateToStamp($this->year, $this->month-1, 1, 0, 0, 0);
562
+        $ts = $this->cE->dateToStamp($this->year, $this->month - 1, 1, 0, 0, 0);
563 563
         return $this->returnValue('Month', $format, $ts, $this->cE->stampToMonth($ts));
564 564
     }
565 565
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
      */
588 588
     function nextMonth($format = 'int')
589 589
     {
590
-        $ts = $this->cE->dateToStamp($this->year, $this->month+1, 1, 0, 0, 0);
590
+        $ts = $this->cE->dateToStamp($this->year, $this->month + 1, 1, 0, 0, 0);
591 591
         return $this->returnValue('Month', $format, $ts, $this->cE->stampToMonth($ts));
592 592
     }
593 593
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
     function prevDay($format = 'int')
603 603
     {
604 604
         $ts = $this->cE->dateToStamp(
605
-            $this->year, $this->month, $this->day-1, 0, 0, 0);
605
+            $this->year, $this->month, $this->day - 1, 0, 0, 0);
606 606
         return $this->returnValue('Day', $format, $ts, $this->cE->stampToDay($ts));
607 607
     }
608 608
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
     function nextDay($format = 'int')
633 633
     {
634 634
         $ts = $this->cE->dateToStamp(
635
-            $this->year, $this->month, $this->day+1, 0, 0, 0);
635
+            $this->year, $this->month, $this->day + 1, 0, 0, 0);
636 636
         return $this->returnValue('Day', $format, $ts, $this->cE->stampToDay($ts));
637 637
     }
638 638
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
     function prevHour($format = 'int')
648 648
     {
649 649
         $ts = $this->cE->dateToStamp(
650
-            $this->year, $this->month, $this->day, $this->hour-1, 0, 0);
650
+            $this->year, $this->month, $this->day, $this->hour - 1, 0, 0);
651 651
         return $this->returnValue('Hour', $format, $ts, $this->cE->stampToHour($ts));
652 652
     }
653 653
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
     function nextHour($format = 'int')
678 678
     {
679 679
         $ts = $this->cE->dateToStamp(
680
-            $this->year, $this->month, $this->day, $this->hour+1, 0, 0);
680
+            $this->year, $this->month, $this->day, $this->hour + 1, 0, 0);
681 681
         return $this->returnValue('Hour', $format, $ts, $this->cE->stampToHour($ts));
682 682
     }
683 683
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
     {
694 694
         $ts = $this->cE->dateToStamp(
695 695
             $this->year, $this->month, $this->day,
696
-            $this->hour, $this->minute-1, 0);
696
+            $this->hour, $this->minute - 1, 0);
697 697
         return $this->returnValue('Minute', $format, $ts, $this->cE->stampToMinute($ts));
698 698
     }
699 699
 
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
     {
726 726
         $ts = $this->cE->dateToStamp(
727 727
             $this->year, $this->month, $this->day,
728
-            $this->hour, $this->minute+1, 0);
728
+            $this->hour, $this->minute + 1, 0);
729 729
         return $this->returnValue('Minute', $format, $ts, $this->cE->stampToMinute($ts));
730 730
     }
731 731
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
     {
742 742
         $ts = $this->cE->dateToStamp(
743 743
             $this->year, $this->month, $this->day,
744
-            $this->hour, $this->minute, $this->second-1);
744
+            $this->hour, $this->minute, $this->second - 1);
745 745
         return $this->returnValue('Second', $format, $ts, $this->cE->stampToSecond($ts));
746 746
     }
747 747
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     {
774 774
         $ts = $this->cE->dateToStamp(
775 775
             $this->year, $this->month, $this->day,
776
-            $this->hour, $this->minute, $this->second+1);
776
+            $this->hour, $this->minute, $this->second + 1);
777 777
         return $this->returnValue('Second', $format, $ts, $this->cE->stampToSecond($ts));
778 778
     }
779 779
 }
Please login to merge, or discard this patch.
Switch Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
     {
89 89
         static $engine = false;
90 90
         switch (CALENDAR_ENGINE) {
91
-        case 'PearDate':
92
-            $class = 'Calendar_Engine_PearDate';
93
-            break;
94
-        case 'UnixTS':
95
-        default:
96
-            $class = 'PEAR\Calendar\Engine\UnixTS';
97
-            break;
91
+            case 'PearDate':
92
+                $class = 'Calendar_Engine_PearDate';
93
+                break;
94
+            case 'UnixTS':
95
+            default:
96
+                $class = 'PEAR\Calendar\Engine\UnixTS';
97
+                break;
98 98
         }
99 99
         if (!$engine) {
100 100
             if (!class_exists($class)) {
@@ -341,18 +341,18 @@  discard block
 block discarded – undo
341 341
     function returnValue($returnType, $format, $stamp, $default)
342 342
     {
343 343
         switch (strtolower($format)) {
344
-        case 'int':
345
-            return $default;
346
-        case 'array':
347
-            return $this->toArray($stamp);
348
-            break;
349
-        case 'object':
350
-            return Factory::createByTimestamp($returnType, $stamp);
351
-            break;
352
-        case 'timestamp':
353
-        default:
354
-            return $stamp;
355
-            break;
344
+            case 'int':
345
+                return $default;
346
+            case 'array':
347
+                return $this->toArray($stamp);
348
+                break;
349
+            case 'object':
350
+                return Factory::createByTimestamp($returnType, $stamp);
351
+                break;
352
+            case 'timestamp':
353
+            default:
354
+                return $stamp;
355
+                break;
356 356
         }
357 357
     }
358 358
 
Please login to merge, or discard this patch.
src/ValidationError.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
      * @return string
138 138
      * @access public
139 139
      */
140
-    function toString ()
140
+    function toString()
141 141
     {
142 142
         return $this->unit.' = '.$this->value.' ['.$this->message.']';
143 143
     }
Please login to merge, or discard this patch.
src/Validator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                 'Hour', $h, CALENDAR_VALUE_TOOSMALL.$min);
206 206
             return false;
207 207
         }
208
-        $max = ($this->cE->getHoursInDay($this->calendar->thisDay())-1);
208
+        $max = ($this->cE->getHoursInDay($this->calendar->thisDay()) - 1);
209 209
         if ($h > $max) {
210 210
             $this->errors[] = new ValidationError(
211 211
                 'Hour', $h, CALENDAR_VALUE_TOOLARGE.$max);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                 'Minute', $i, CALENDAR_VALUE_TOOSMALL.$min);
230 230
             return false;
231 231
         }
232
-        $max = ($this->cE->getMinutesInHour($this->calendar->thisHour())-1);
232
+        $max = ($this->cE->getMinutesInHour($this->calendar->thisHour()) - 1);
233 233
         if ($i > $max) {
234 234
             $this->errors[] = new ValidationError(
235 235
                 'Minute', $i, CALENDAR_VALUE_TOOLARGE.$max);
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                 'Second', $s, CALENDAR_VALUE_TOOSMALL.$min);
254 254
             return false;
255 255
         }
256
-        $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute())-1);
256
+        $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute()) - 1);
257 257
         if ($s > $max) {
258 258
             $this->errors[] = new ValidationError(
259 259
                 'Second', $s, CALENDAR_VALUE_TOOLARGE.$max);
Please login to merge, or discard this patch.
src/Hour.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,11 +83,11 @@
 block discarded – undo
83 83
     function build($sDates = array())
84 84
     {
85 85
         $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day,
86
-                           $this->hour);
86
+                            $this->hour);
87 87
         for ($i=0; $i < $mIH; $i++) {
88 88
             $this->children[$i] =
89 89
                 new Minute($this->year, $this->month, $this->day,
90
-                           $this->hour, $i);
90
+                            $this->hour, $i);
91 91
         }
92 92
         if (count($sDates) > 0) {
93 93
             $this->setSelection($sDates);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
     {
85 85
         $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day,
86 86
                            $this->hour);
87
-        for ($i=0; $i < $mIH; $i++) {
87
+        for ($i = 0; $i < $mIH; $i++) {
88 88
             $this->children[$i] =
89 89
                 new Minute($this->year, $this->month, $this->day,
90 90
                            $this->hour, $i);
Please login to merge, or discard this patch.
src/Factory.php 1 patch
Switch Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -83,41 +83,41 @@
 block discarded – undo
83 83
     {
84 84
         $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1;
85 85
         switch ($type) {
86
-        case 'Day':
87
-            return new Day($y, $m, $d);
88
-        case 'Month':
89
-            // Set default state for which month type to build
90
-            if (!defined('CALENDAR_MONTH_STATE')) {
91
-                define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH);
92
-            }
93
-            switch (CALENDAR_MONTH_STATE) {
94
-            case CALENDAR_USE_MONTH_WEEKDAYS:
95
-                $class = 'PEAR\Calendar\Month\Weekdays';
96
-                break;
97
-            case CALENDAR_USE_MONTH_WEEKS:
98
-                $class = 'PEAR\Calendar\Month\Weeks';
99
-                break;
100
-            case CALENDAR_USE_MONTH:
101
-            default:
102
-                $class = 'PEAR\Calendar\Month';
103
-                break;
104
-            }
86
+            case 'Day':
87
+                return new Day($y, $m, $d);
88
+            case 'Month':
89
+                // Set default state for which month type to build
90
+                if (!defined('CALENDAR_MONTH_STATE')) {
91
+                    define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH);
92
+                }
93
+                switch (CALENDAR_MONTH_STATE) {
94
+                    case CALENDAR_USE_MONTH_WEEKDAYS:
95
+                        $class = 'PEAR\Calendar\Month\Weekdays';
96
+                        break;
97
+                    case CALENDAR_USE_MONTH_WEEKS:
98
+                        $class = 'PEAR\Calendar\Month\Weeks';
99
+                        break;
100
+                    case CALENDAR_USE_MONTH:
101
+                    default:
102
+                        $class = 'PEAR\Calendar\Month';
103
+                        break;
104
+                }
105 105
             return new $class($y, $m, $firstDay);
106
-        case 'Week':
107
-            return new Week($y, $m, $d, $firstDay);
108
-        case 'Hour':
109
-            return new Hour($y, $m, $d, $h);
110
-        case 'Minute':
111
-            return new Minute($y, $m, $d, $h, $i);
112
-        case 'Second':
113
-            return new Second($y, $m, $d, $h, $i, $s);
114
-        case 'Year':
115
-            return new Year($y);
116
-        default:
117
-            include_once 'PEAR.php';
118
-            PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type,
119
-                null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()');
120
-            return false;
106
+            case 'Week':
107
+                return new Week($y, $m, $d, $firstDay);
108
+            case 'Hour':
109
+                return new Hour($y, $m, $d, $h);
110
+            case 'Minute':
111
+                return new Minute($y, $m, $d, $h, $i);
112
+            case 'Second':
113
+                return new Second($y, $m, $d, $h, $i, $s);
114
+            case 'Year':
115
+                return new Year($y);
116
+            default:
117
+                include_once 'PEAR.php';
118
+                PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type,
119
+                    null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()');
120
+                return false;
121 121
         }
122 122
     }
123 123
 
Please login to merge, or discard this patch.
src/Month.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @access public
68 68
      */
69
-    function __construct($y, $m, $firstDay=null)
69
+    function __construct($y, $m, $firstDay = null)
70 70
     {
71 71
         parent::__construct($y, $m);
72 72
         $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     function build($sDates = array())
85 85
     {
86 86
         $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
87
-        for ($i=1; $i<=$daysInMonth; $i++) {
87
+        for ($i = 1; $i <= $daysInMonth; $i++) {
88 88
             $this->children[$i] = new Day($this->year, $this->month, $i);
89 89
         }
90 90
         if (count($sDates) > 0) {
Please login to merge, or discard this patch.
src/Day.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     function build($sDates = array())
112 112
     {
113 113
         $hID = $this->cE->getHoursInDay($this->year, $this->month, $this->day);
114
-        for ($i=0; $i < $hID; $i++) {
114
+        for ($i = 0; $i < $hID; $i++) {
115 115
             $this->children[$i] =
116 116
                 new Hour($this->year, $this->month, $this->day, $i);
117 117
         }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      * @return void
207 207
      * @access private
208 208
      */
209
-    function setEmpty ($state = true)
209
+    function setEmpty($state = true)
210 210
     {
211 211
         $this->empty = $state;
212 212
     }
Please login to merge, or discard this patch.
src/Minute.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
     {
86 86
         $sIM = $this->cE->getSecondsInMinute($this->year, $this->month,
87 87
                 $this->day, $this->hour, $this->minute);
88
-        for ($i=0; $i < $sIM; $i++) {
88
+        for ($i = 0; $i < $sIM; $i++) {
89 89
             $this->children[$i] = new Second($this->year, $this->month,
90 90
                 $this->day, $this->hour, $this->minute, $i);
91 91
         }
Please login to merge, or discard this patch.