@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | break; |
| 93 | 93 | |
| 94 | 94 | case self::LAST_YEAR: |
| 95 | - $year = ((int) date('Y'))- 1; |
|
| 95 | + $year = ((int) date('Y')) - 1; |
|
| 96 | 96 | break; |
| 97 | 97 | |
| 98 | 98 | default: |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $d->setDate($year, $d->format('m'), $d->format('d')); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $d->add(new \DateInterval('P'.($day - 1).'D')); |
|
| 143 | + $d->add(new \DateInterval('P' . ($day - 1) . 'D')); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | return $d; |
@@ -61,8 +61,9 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public static function getMonth($month_number) |
| 63 | 63 | { |
| 64 | - if (!array_key_exists($month_number, self::MONTHS)) |
|
| 65 | - throw new MonthOutOfRange("Invalid Month"); |
|
| 64 | + if (!array_key_exists($month_number, self::MONTHS)) { |
|
| 65 | + throw new MonthOutOfRange("Invalid Month"); |
|
| 66 | + } |
|
| 66 | 67 | |
| 67 | 68 | return self::MONTHS[$month_number]; |
| 68 | 69 | } |
@@ -76,14 +77,17 @@ discard block |
||
| 76 | 77 | */ |
| 77 | 78 | public static function create(array $date = []) |
| 78 | 79 | { |
| 79 | - if (!array_key_exists('day', $date)) |
|
| 80 | - $date["day"] = self::TODAY; |
|
| 80 | + if (!array_key_exists('day', $date)) { |
|
| 81 | + $date["day"] = self::TODAY; |
|
| 82 | + } |
|
| 81 | 83 | |
| 82 | - if (!array_key_exists('month', $date)) |
|
| 83 | - $date["month"] = self::THIS_MONTH; |
|
| 84 | + if (!array_key_exists('month', $date)) { |
|
| 85 | + $date["month"] = self::THIS_MONTH; |
|
| 86 | + } |
|
| 84 | 87 | |
| 85 | - if (!array_key_exists('year', $date)) |
|
| 86 | - $date["year"] = self::THIS_YEAR; |
|
| 88 | + if (!array_key_exists('year', $date)) { |
|
| 89 | + $date["year"] = self::THIS_YEAR; |
|
| 90 | + } |
|
| 87 | 91 | |
| 88 | 92 | switch ($date['year']) |
| 89 | 93 | { |
@@ -128,13 +132,13 @@ discard block |
||
| 128 | 132 | break; |
| 129 | 133 | } |
| 130 | 134 | |
| 131 | - if (is_string($day)) |
|
| 132 | - $d = new \DateTime("$day $month $year"); |
|
| 133 | - else |
|
| 135 | + if (is_string($day)) { |
|
| 136 | + $d = new \DateTime("$day $month $year"); |
|
| 137 | + } else |
|
| 134 | 138 | { |
| 135 | - if (in_array($month, self::MONTHS)) |
|
| 136 | - $d = new \DateTime("first day of $month $year"); |
|
| 137 | - else |
|
| 139 | + if (in_array($month, self::MONTHS)) { |
|
| 140 | + $d = new \DateTime("first day of $month $year"); |
|
| 141 | + } else |
|
| 138 | 142 | { |
| 139 | 143 | $d = new \DateTime("first day of $month"); |
| 140 | 144 | $d->setDate($year, $d->format('m'), $d->format('d')); |