Passed
Pull Request — master (#2)
by tsms
03:23 queued 01:20
created
src/Week.php 1 patch
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.
src/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.
src/Calendar.php 1 patch
Switch Indentation   +20 added lines, -20 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,19 +341,19 @@  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
-            include_once CALENDAR_ROOT.'Factory.php';
351
-            return Factory::createByTimestamp($returnType, $stamp);
352
-            break;
353
-        case 'timestamp':
354
-        default:
355
-            return $stamp;
356
-            break;
344
+            case 'int':
345
+                return $default;
346
+            case 'array':
347
+                return $this->toArray($stamp);
348
+                break;
349
+            case 'object':
350
+                include_once CALENDAR_ROOT.'Factory.php';
351
+                return Factory::createByTimestamp($returnType, $stamp);
352
+                break;
353
+            case 'timestamp':
354
+            default:
355
+                return $stamp;
356
+                break;
357 357
         }
358 358
     }
359 359
 
Please login to merge, or discard this patch.