Passed
Pull Request — master (#2)
by tsms
01:48
created
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/Calendar.php 1 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/Week.php 1 patch
Switch Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -331,21 +331,21 @@  discard block
 block discarded – undo
331 331
     function prevWeek($format = 'n_in_month')
332 332
     {
333 333
         switch (strtolower($format)) {
334
-        case 'int':
335
-        case 'n_in_month':
336
-            return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1;
337
-        case 'n_in_year':
338
-            return $this->cE->getWeekNInYear(
339
-                $this->cE->stampToYear($this->prevWeek),
340
-                $this->cE->stampToMonth($this->prevWeek),
341
-                $this->cE->stampToDay($this->prevWeek));
342
-        case 'array':
343
-            return $this->toArray($this->prevWeek);
344
-        case 'object':
345
-            return Factory::createByTimestamp('Week', $this->prevWeek);
346
-        case 'timestamp':
347
-        default:
348
-            return $this->prevWeek;
334
+            case 'int':
335
+            case 'n_in_month':
336
+                return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1;
337
+            case 'n_in_year':
338
+                return $this->cE->getWeekNInYear(
339
+                    $this->cE->stampToYear($this->prevWeek),
340
+                    $this->cE->stampToMonth($this->prevWeek),
341
+                    $this->cE->stampToDay($this->prevWeek));
342
+            case 'array':
343
+                return $this->toArray($this->prevWeek);
344
+            case 'object':
345
+                return Factory::createByTimestamp('Week', $this->prevWeek);
346
+            case 'timestamp':
347
+            default:
348
+                return $this->prevWeek;
349 349
         }
350 350
     }
351 351
 
@@ -360,34 +360,34 @@  discard block
 block discarded – undo
360 360
     function thisWeek($format = 'n_in_month')
361 361
     {
362 362
         switch (strtolower($format)) {
363
-        case 'int':
364
-        case 'n_in_month':
365
-            if ($this->firstWeek) {
366
-                return 1;
367
-            }
368
-            if ($this->lastWeek) {
369
-                return $this->cE->getWeeksInMonth(
363
+            case 'int':
364
+            case 'n_in_month':
365
+                if ($this->firstWeek) {
366
+                    return 1;
367
+                }
368
+                if ($this->lastWeek) {
369
+                    return $this->cE->getWeeksInMonth(
370
+                        $this->thisYear(),
371
+                        $this->thisMonth(),
372
+                        $this->firstDay);
373
+                }
374
+                return $this->cE->getWeekNInMonth(
370 375
                     $this->thisYear(),
371 376
                     $this->thisMonth(),
377
+                    $this->thisDay(),
372 378
                     $this->firstDay);
373
-            }
374
-            return $this->cE->getWeekNInMonth(
375
-                $this->thisYear(),
376
-                $this->thisMonth(),
377
-                $this->thisDay(),
378
-                $this->firstDay);
379
-        case 'n_in_year':
380
-            return $this->cE->getWeekNInYear(
381
-                $this->cE->stampToYear($this->thisWeek),
382
-                $this->cE->stampToMonth($this->thisWeek),
383
-                $this->cE->stampToDay($this->thisWeek));
384
-        case 'array':
385
-            return $this->toArray($this->thisWeek);
386
-        case 'object':
387
-            return Factory::createByTimestamp('Week', $this->thisWeek);
388
-        case 'timestamp':
389
-        default:
390
-            return $this->thisWeek;
379
+            case 'n_in_year':
380
+                return $this->cE->getWeekNInYear(
381
+                    $this->cE->stampToYear($this->thisWeek),
382
+                    $this->cE->stampToMonth($this->thisWeek),
383
+                    $this->cE->stampToDay($this->thisWeek));
384
+            case 'array':
385
+                return $this->toArray($this->thisWeek);
386
+            case 'object':
387
+                return Factory::createByTimestamp('Week', $this->thisWeek);
388
+            case 'timestamp':
389
+            default:
390
+                return $this->thisWeek;
391 391
         }
392 392
     }
393 393
 
@@ -402,21 +402,21 @@  discard block
 block discarded – undo
402 402
     function nextWeek($format = 'n_in_month')
403 403
     {
404 404
         switch (strtolower($format)) {
405
-        case 'int':
406
-        case 'n_in_month':
407
-            return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1;
408
-        case 'n_in_year':
409
-            return $this->cE->getWeekNInYear(
410
-                $this->cE->stampToYear($this->nextWeek),
411
-                $this->cE->stampToMonth($this->nextWeek),
412
-                $this->cE->stampToDay($this->nextWeek));
413
-        case 'array':
414
-            return $this->toArray($this->nextWeek);
415
-        case 'object':
416
-            return Factory::createByTimestamp('Week', $this->nextWeek);
417
-        case 'timestamp':
418
-        default:
419
-            return $this->nextWeek;
405
+            case 'int':
406
+            case 'n_in_month':
407
+                return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1;
408
+            case 'n_in_year':
409
+                return $this->cE->getWeekNInYear(
410
+                    $this->cE->stampToYear($this->nextWeek),
411
+                    $this->cE->stampToMonth($this->nextWeek),
412
+                    $this->cE->stampToDay($this->nextWeek));
413
+            case 'array':
414
+                return $this->toArray($this->nextWeek);
415
+            case 'object':
416
+                return Factory::createByTimestamp('Week', $this->nextWeek);
417
+            case 'timestamp':
418
+            default:
419
+                return $this->nextWeek;
420 420
         }
421 421
     }
422 422
 
Please login to merge, or discard this patch.