Passed
Pull Request — master (#2)
by tsms
01:37
created
Calendar/Hour.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,11 +98,11 @@
 block discarded – undo
98 98
     {
99 99
         include_once CALENDAR_ROOT.'Minute.php';
100 100
         $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day,
101
-                           $this->hour);
101
+                            $this->hour);
102 102
         for ($i=0; $i < $mIH; $i++) {
103 103
             $this->children[$i] =
104 104
                 new Minute($this->year, $this->month, $this->day,
105
-                           $this->hour, $i);
105
+                            $this->hour, $i);
106 106
         }
107 107
         if (count($sDates) > 0) {
108 108
             $this->setSelection($sDates);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
         include_once CALENDAR_ROOT.'Minute.php';
100 100
         $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day,
101 101
                            $this->hour);
102
-        for ($i=0; $i < $mIH; $i++) {
102
+        for ($i = 0; $i < $mIH; $i++) {
103 103
             $this->children[$i] =
104 104
                 new Minute($this->year, $this->month, $this->day,
105 105
                            $this->hour, $i);
Please login to merge, or discard this patch.
Calendar/Factory.php 1 patch
Switch Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -96,41 +96,41 @@
 block discarded – undo
96 96
     {
97 97
         $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1;
98 98
         switch ($type) {
99
-        case 'Day':
100
-            return new Day($y, $m, $d);
101
-        case 'Month':
102
-            // Set default state for which month type to build
103
-            if (!defined('CALENDAR_MONTH_STATE')) {
104
-                define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH);
105
-            }
106
-            switch (CALENDAR_MONTH_STATE) {
107
-            case CALENDAR_USE_MONTH_WEEKDAYS:
108
-                $class = 'Calendar_Month_Weekdays';
109
-                break;
110
-            case CALENDAR_USE_MONTH_WEEKS:
111
-                $class = 'Calendar_Month_Weeks';
112
-                break;
113
-            case CALENDAR_USE_MONTH:
114
-            default:
115
-                $class = 'Pear\Calendar\Month';
116
-                break;
117
-            }
99
+            case 'Day':
100
+                return new Day($y, $m, $d);
101
+            case 'Month':
102
+                // Set default state for which month type to build
103
+                if (!defined('CALENDAR_MONTH_STATE')) {
104
+                    define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH);
105
+                }
106
+                switch (CALENDAR_MONTH_STATE) {
107
+                    case CALENDAR_USE_MONTH_WEEKDAYS:
108
+                        $class = 'Calendar_Month_Weekdays';
109
+                        break;
110
+                    case CALENDAR_USE_MONTH_WEEKS:
111
+                        $class = 'Calendar_Month_Weeks';
112
+                        break;
113
+                    case CALENDAR_USE_MONTH:
114
+                    default:
115
+                        $class = 'Pear\Calendar\Month';
116
+                        break;
117
+                }
118 118
             return new $class($y, $m, $firstDay);
119
-        case 'Week':
120
-            return new Week($y, $m, $d, $firstDay);
121
-        case 'Hour':
122
-            return new Hour($y, $m, $d, $h);
123
-        case 'Minute':
124
-            return new Minute($y, $m, $d, $h, $i);
125
-        case 'Second':
126
-            return new Second($y, $m, $d, $h, $i, $s);
127
-        case 'Year':
128
-            return new Year($y);
129
-        default:
130
-            include_once 'PEAR.php';
131
-            PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type,
132
-                null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()');
133
-            return false;
119
+            case 'Week':
120
+                return new Week($y, $m, $d, $firstDay);
121
+            case 'Hour':
122
+                return new Hour($y, $m, $d, $h);
123
+            case 'Minute':
124
+                return new Minute($y, $m, $d, $h, $i);
125
+            case 'Second':
126
+                return new Second($y, $m, $d, $h, $i, $s);
127
+            case 'Year':
128
+                return new Year($y);
129
+            default:
130
+                include_once 'PEAR.php';
131
+                PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type,
132
+                    null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()');
133
+                return false;
134 134
         }
135 135
     }
136 136
 
Please login to merge, or discard this patch.
Calendar/Minute.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
         include_once CALENDAR_ROOT.'Second.php';
101 101
         $sIM = $this->cE->getSecondsInMinute($this->year, $this->month,
102 102
                 $this->day, $this->hour, $this->minute);
103
-        for ($i=0; $i < $sIM; $i++) {
103
+        for ($i = 0; $i < $sIM; $i++) {
104 104
             $this->children[$i] = new Second($this->year, $this->month,
105 105
                 $this->day, $this->hour, $this->minute, $i);
106 106
         }
Please login to merge, or discard this patch.
Calendar/Week.php 2 patches
Switch Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -346,22 +346,22 @@  discard block
 block discarded – undo
346 346
     function prevWeek($format = 'n_in_month')
347 347
     {
348 348
         switch (strtolower($format)) {
349
-        case 'int':
350
-        case 'n_in_month':
351
-            return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1;
352
-        case 'n_in_year':
353
-            return $this->cE->getWeekNInYear(
354
-                $this->cE->stampToYear($this->prevWeek),
355
-                $this->cE->stampToMonth($this->prevWeek),
356
-                $this->cE->stampToDay($this->prevWeek));
357
-        case 'array':
358
-            return $this->toArray($this->prevWeek);
359
-        case 'object':
360
-            include_once CALENDAR_ROOT.'Factory.php';
361
-            return Factory::createByTimestamp('Week', $this->prevWeek);
362
-        case 'timestamp':
363
-        default:
364
-            return $this->prevWeek;
349
+            case 'int':
350
+            case 'n_in_month':
351
+                return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1;
352
+            case 'n_in_year':
353
+                return $this->cE->getWeekNInYear(
354
+                    $this->cE->stampToYear($this->prevWeek),
355
+                    $this->cE->stampToMonth($this->prevWeek),
356
+                    $this->cE->stampToDay($this->prevWeek));
357
+            case 'array':
358
+                return $this->toArray($this->prevWeek);
359
+            case 'object':
360
+                include_once CALENDAR_ROOT.'Factory.php';
361
+                return Factory::createByTimestamp('Week', $this->prevWeek);
362
+            case 'timestamp':
363
+            default:
364
+                return $this->prevWeek;
365 365
         }
366 366
     }
367 367
 
@@ -376,35 +376,35 @@  discard block
 block discarded – undo
376 376
     function thisWeek($format = 'n_in_month')
377 377
     {
378 378
         switch (strtolower($format)) {
379
-        case 'int':
380
-        case 'n_in_month':
381
-            if ($this->firstWeek) {
382
-                return 1;
383
-            }
384
-            if ($this->lastWeek) {
385
-                return $this->cE->getWeeksInMonth(
379
+            case 'int':
380
+            case 'n_in_month':
381
+                if ($this->firstWeek) {
382
+                    return 1;
383
+                }
384
+                if ($this->lastWeek) {
385
+                    return $this->cE->getWeeksInMonth(
386
+                        $this->thisYear(),
387
+                        $this->thisMonth(),
388
+                        $this->firstDay);
389
+                }
390
+                return $this->cE->getWeekNInMonth(
386 391
                     $this->thisYear(),
387 392
                     $this->thisMonth(),
393
+                    $this->thisDay(),
388 394
                     $this->firstDay);
389
-            }
390
-            return $this->cE->getWeekNInMonth(
391
-                $this->thisYear(),
392
-                $this->thisMonth(),
393
-                $this->thisDay(),
394
-                $this->firstDay);
395
-        case 'n_in_year':
396
-            return $this->cE->getWeekNInYear(
397
-                $this->cE->stampToYear($this->thisWeek),
398
-                $this->cE->stampToMonth($this->thisWeek),
399
-                $this->cE->stampToDay($this->thisWeek));
400
-        case 'array':
401
-            return $this->toArray($this->thisWeek);
402
-        case 'object':
403
-            include_once CALENDAR_ROOT.'Factory.php';
404
-            return Factory::createByTimestamp('Week', $this->thisWeek);
405
-        case 'timestamp':
406
-        default:
407
-            return $this->thisWeek;
395
+            case 'n_in_year':
396
+                return $this->cE->getWeekNInYear(
397
+                    $this->cE->stampToYear($this->thisWeek),
398
+                    $this->cE->stampToMonth($this->thisWeek),
399
+                    $this->cE->stampToDay($this->thisWeek));
400
+            case 'array':
401
+                return $this->toArray($this->thisWeek);
402
+            case 'object':
403
+                include_once CALENDAR_ROOT.'Factory.php';
404
+                return Factory::createByTimestamp('Week', $this->thisWeek);
405
+            case 'timestamp':
406
+            default:
407
+                return $this->thisWeek;
408 408
         }
409 409
     }
410 410
 
@@ -419,22 +419,22 @@  discard block
 block discarded – undo
419 419
     function nextWeek($format = 'n_in_month')
420 420
     {
421 421
         switch (strtolower($format)) {
422
-        case 'int':
423
-        case 'n_in_month':
424
-            return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1;
425
-        case 'n_in_year':
426
-            return $this->cE->getWeekNInYear(
427
-                $this->cE->stampToYear($this->nextWeek),
428
-                $this->cE->stampToMonth($this->nextWeek),
429
-                $this->cE->stampToDay($this->nextWeek));
430
-        case 'array':
431
-            return $this->toArray($this->nextWeek);
432
-        case 'object':
433
-            include_once CALENDAR_ROOT.'Factory.php';
434
-            return Factory::createByTimestamp('Week', $this->nextWeek);
435
-        case 'timestamp':
436
-        default:
437
-            return $this->nextWeek;
422
+            case 'int':
423
+            case 'n_in_month':
424
+                return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1;
425
+            case 'n_in_year':
426
+                return $this->cE->getWeekNInYear(
427
+                    $this->cE->stampToYear($this->nextWeek),
428
+                    $this->cE->stampToMonth($this->nextWeek),
429
+                    $this->cE->stampToDay($this->nextWeek));
430
+            case 'array':
431
+                return $this->toArray($this->nextWeek);
432
+            case 'object':
433
+                include_once CALENDAR_ROOT.'Factory.php';
434
+                return Factory::createByTimestamp('Week', $this->nextWeek);
435
+            case 'timestamp':
436
+            default:
437
+                return $this->nextWeek;
438 438
         }
439 439
     }
440 440
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             $this->thisDay()
224 224
         );
225 225
 
226
-        for ($i=1; $i <= $end; $i++) {
226
+        for ($i = 1; $i <= $end; $i++) {
227 227
             $stamp = $this->cE->dateToStamp($year, $month, $day++);
228 228
             $this->children[$i] = new Day(
229 229
                 $this->cE->stampToYear($stamp),
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
         //set empty days (@see Calendar_Month_Weeks::build())
236 236
         if ($this->firstWeek) {
237 237
             $eBefore = $this->tableHelper->getEmptyDaysBefore();
238
-            for ($i=1; $i <= $eBefore; $i++) {
238
+            for ($i = 1; $i <= $eBefore; $i++) {
239 239
                 $this->children[$i]->setEmpty();
240 240
             }
241 241
         }
242 242
         if ($this->lastWeek) {
243 243
             $eAfter = $this->tableHelper->getEmptyDaysAfterOffset();
244
-            for ($i = $eAfter+1; $i <= $end; $i++) {
244
+            for ($i = $eAfter + 1; $i <= $end; $i++) {
245 245
                 $this->children[$i]->setEmpty();
246 246
             }
247 247
         }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         switch (strtolower($format)) {
349 349
         case 'int':
350 350
         case 'n_in_month':
351
-            return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1;
351
+            return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') - 1;
352 352
         case 'n_in_year':
353 353
             return $this->cE->getWeekNInYear(
354 354
                 $this->cE->stampToYear($this->prevWeek),
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
         switch (strtolower($format)) {
422 422
         case 'int':
423 423
         case 'n_in_month':
424
-            return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1;
424
+            return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') + 1;
425 425
         case 'n_in_year':
426 426
             return $this->cE->getWeekNInYear(
427 427
                 $this->cE->stampToYear($this->nextWeek),
Please login to merge, or discard this patch.
Calendar/Month.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @access public
82 82
      */
83
-    function __construct($y, $m, $firstDay=null)
83
+    function __construct($y, $m, $firstDay = null)
84 84
     {
85 85
         parent::__construct($y, $m);
86 86
         $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         include_once CALENDAR_ROOT.'Day.php';
101 101
         $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
102
-        for ($i=1; $i<=$daysInMonth; $i++) {
102
+        for ($i = 1; $i <= $daysInMonth; $i++) {
103 103
             $this->children[$i] = new Day($this->year, $this->month, $i);
104 104
         }
105 105
         if (count($sDates) > 0) {
Please login to merge, or discard this patch.
Calendar/Year.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
         include_once CALENDAR_ROOT.'Factory.php';
109 109
         $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
110 110
         $monthsInYear   = $this->cE->getMonthsInYear($this->thisYear());
111
-        for ($i=1; $i <= $monthsInYear; $i++) {
111
+        for ($i = 1; $i <= $monthsInYear; $i++) {
112 112
             $this->children[$i] = Factory::create('Month', $this->year, $i);
113 113
         }
114 114
         if (count($sDates) > 0) {
Please login to merge, or discard this patch.
Calendar/Day.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         include_once CALENDAR_ROOT.'Hour.php';
120 120
 
121 121
         $hID = $this->cE->getHoursInDay($this->year, $this->month, $this->day);
122
-        for ($i=0; $i < $hID; $i++) {
122
+        for ($i = 0; $i < $hID; $i++) {
123 123
             $this->children[$i] =
124 124
                 new Hour($this->year, $this->month, $this->day, $i);
125 125
         }
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      * @return void
215 215
      * @access private
216 216
      */
217
-    function setEmpty ($state = true)
217
+    function setEmpty($state = true)
218 218
     {
219 219
         $this->empty = $state;
220 220
     }
Please login to merge, or discard this patch.
Calendar/Engine/UnixTS.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     function stampCollection($stamp)
78 78
     {
79 79
         static $stamps = array();
80
-        if ( !isset($stamps[$stamp]) ) {
80
+        if (!isset($stamps[$stamp])) {
81 81
             $date = @date('Y n j H i s t W w', $stamp);
82 82
             $stamps[$stamp] = sscanf($date, "%d %d %d %d %d %d %d %d %d");
83 83
         }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      * @return int Unix timestamp
182 182
      * @access protected
183 183
      */
184
-    function dateToStamp($y, $m, $d, $h=0, $i=0, $s=0)
184
+    function dateToStamp($y, $m, $d, $h = 0, $i = 0, $s = 0)
185 185
     {
186 186
         static $dates = array();
187 187
         if (!isset($dates[$y][$m][$d][$h][$i][$s])) {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      * @return int (12)
221 221
      * @access protected
222 222
      */
223
-    function getMonthsInYear($y=null)
223
+    function getMonthsInYear($y = null)
224 224
     {
225 225
         return 12;
226 226
     }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      * @return int (7)
269 269
      * @access protected
270 270
      */
271
-    function getDaysInWeek($y=null, $m=null, $d=null)
271
+    function getDaysInWeek($y = null, $m = null, $d = null)
272 272
     {
273 273
         return 7;
274 274
     }
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
      * @return int week number
302 302
      * @access protected
303 303
      */
304
-    function getWeekNInMonth($y, $m, $d, $firstDay=1)
304
+    function getWeekNInMonth($y, $m, $d, $firstDay = 1)
305 305
     {
306
-        $weekEnd = (0 == $firstDay) ? $this->getDaysInWeek()-1 : $firstDay-1;
306
+        $weekEnd = (0 == $firstDay) ? $this->getDaysInWeek() - 1 : $firstDay - 1;
307 307
         $end_of_week = 1;
308 308
         while (@date('w', @mktime(0, 0, 0, $m, $end_of_week, $y)) != $weekEnd) {
309 309
             ++$end_of_week; //find first weekend of the month
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
      * @return array (0,1,2,3,4,5,6) 1 = Monday
372 372
      * @access protected
373 373
      */
374
-    function getWeekDays($y=null, $m=null, $d=null)
374
+    function getWeekDays($y = null, $m = null, $d = null)
375 375
     {
376 376
         return array(0, 1, 2, 3, 4, 5, 6);
377 377
     }
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
      * @return int (default 1 = Monday)
387 387
      * @access protected
388 388
      */
389
-    function getFirstDayOfWeek($y=null, $m=null, $d=null)
389
+    function getFirstDayOfWeek($y = null, $m = null, $d = null)
390 390
     {
391 391
         return 1;
392 392
     }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
      * @return int (24)
402 402
      * @access protected
403 403
      */
404
-    function getHoursInDay($y=null, $m=null, $d=null)
404
+    function getHoursInDay($y = null, $m = null, $d = null)
405 405
     {
406 406
         return 24;
407 407
     }
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
      * @return int (60)
418 418
      * @access protected
419 419
      */
420
-    function getMinutesInHour($y=null, $m=null, $d=null, $h=null)
420
+    function getMinutesInHour($y = null, $m = null, $d = null, $h = null)
421 421
     {
422 422
         return 60;
423 423
     }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      * @return int (60)
435 435
      * @access protected
436 436
      */
437
-    function getSecondsInMinute($y=null, $m=null, $d=null, $h=null, $i=null)
437
+    function getSecondsInMinute($y = null, $m = null, $d = null, $h = null, $i = null)
438 438
     {
439 439
         return 60;
440 440
     }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
             $today = sscanf($today_date, '%d %d %d');
456 456
         }
457 457
         $date = UnixTS::stampCollection($stamp);
458
-        return (   $date[2] == $today[2]
458
+        return ($date[2] == $today[2]
459 459
                 && $date[1] == $today[1]
460 460
                 && $date[0] == $today[0]
461 461
         );
Please login to merge, or discard this patch.
Calendar/Month/Weeks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      *
106 106
      * @access public
107 107
      */
108
-    function __construct($y, $m, $firstDay=null)
108
+    function __construct($y, $m, $firstDay = null)
109 109
     {
110 110
         parent::__construct($y, $m, $firstDay);
111 111
     }
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
         $this->tableHelper = new Helper($this, $this->firstDay);
125 125
         include_once CALENDAR_ROOT.'Week.php';
126 126
         $numWeeks = $this->tableHelper->getNumWeeks();
127
-        for ($i=1, $d=1; $i<=$numWeeks; $i++,
128
-            $d+=$this->cE->getDaysInWeek(
127
+        for ($i = 1, $d = 1; $i <= $numWeeks; $i++,
128
+            $d += $this->cE->getDaysInWeek(
129 129
                 $this->thisYear(),
130 130
                 $this->thisMonth(),
131 131
                 $this->thisDay()
Please login to merge, or discard this patch.