@@ -63,6 +63,10 @@ |
||
| 63 | 63 | * |
| 64 | 64 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
| 65 | 65 | */ |
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * @param \DateTime $date_time |
|
| 69 | + */ |
|
| 66 | 70 | public function __construct( $date_time = NULL ) { |
| 67 | 71 | |
| 68 | 72 | if ( $date_time !== NULL ) { |
@@ -120,7 +120,9 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | foreach ( $this->config[ 'month_days_number' ] as $month => $value ) { |
| 122 | 122 | |
| 123 | - if ( $this->month > $month ) $days_of_year += $value; |
|
| 123 | + if ( $this->month > $month ) { |
|
| 124 | + $days_of_year += $value; |
|
| 125 | + } |
|
| 124 | 126 | |
| 125 | 127 | } |
| 126 | 128 | |
@@ -136,9 +138,7 @@ discard block |
||
| 136 | 138 | |
| 137 | 139 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 621 ) / 4 ) ); |
| 138 | 140 | |
| 139 | - } |
|
| 140 | - |
|
| 141 | - elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
| 141 | + } elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
| 142 | 142 | |
| 143 | 143 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 622 ) / 4 ) ); |
| 144 | 144 | |
@@ -152,7 +152,9 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
| 154 | 154 | |
| 155 | - if ( $gregorian_month < $value ) break; |
|
| 155 | + if ( $gregorian_month < $value ) { |
|
| 156 | + break; |
|
| 157 | + } |
|
| 156 | 158 | |
| 157 | 159 | $gregorian_month -= $value; |
| 158 | 160 | } |
@@ -197,7 +199,9 @@ discard block |
||
| 197 | 199 | |
| 198 | 200 | $this->leap = new Leap( $this->year ); |
| 199 | 201 | |
| 200 | - if ( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
| 202 | + if ( $this->leap->get() && $this->month > 11 ) { |
|
| 203 | + $this->temp_day++; |
|
| 204 | + } |
|
| 201 | 205 | |
| 202 | 206 | $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
| 203 | 207 | |
@@ -272,7 +276,9 @@ discard block |
||
| 272 | 276 | |
| 273 | 277 | foreach ( $this->config[ 'month_days_number' ] as $month => $value ) { |
| 274 | 278 | |
| 275 | - if ( $this->month > $month ) $days_of_year += $value; |
|
| 279 | + if ( $this->month > $month ) { |
|
| 280 | + $days_of_year += $value; |
|
| 281 | + } |
|
| 276 | 282 | |
| 277 | 283 | } |
| 278 | 284 | |
@@ -294,7 +300,9 @@ discard block |
||
| 294 | 300 | |
| 295 | 301 | foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
| 296 | 302 | |
| 297 | - if ( $jalali_month < $value ) break; |
|
| 303 | + if ( $jalali_month < $value ) { |
|
| 304 | + break; |
|
| 305 | + } |
|
| 298 | 306 | |
| 299 | 307 | $jalali_month -= $value; |
| 300 | 308 | } |
@@ -330,7 +338,9 @@ discard block |
||
| 330 | 338 | |
| 331 | 339 | foreach ( $this->config[ 'month_days_number' ] as $month => $value ) { |
| 332 | 340 | |
| 333 | - if ( $this->month > $month ) $days_of_year += $value; |
|
| 341 | + if ( $this->month > $month ) { |
|
| 342 | + $days_of_year += $value; |
|
| 343 | + } |
|
| 334 | 344 | |
| 335 | 345 | } |
| 336 | 346 | |
@@ -352,7 +362,9 @@ discard block |
||
| 352 | 362 | |
| 353 | 363 | foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
| 354 | 364 | |
| 355 | - if ( $gregorian_month < $value ) break; |
|
| 365 | + if ( $gregorian_month < $value ) { |
|
| 366 | + break; |
|
| 367 | + } |
|
| 356 | 368 | |
| 357 | 369 | $gregorian_month -= $value; |
| 358 | 370 | } |
@@ -56,6 +56,10 @@ |
||
| 56 | 56 | * |
| 57 | 57 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ |
| 58 | 58 | */ |
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * @param string $path |
|
| 62 | + */ |
|
| 59 | 63 | private function fetch( $path ) { |
| 60 | 64 | |
| 61 | 65 | $this->events = include( $path ); |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | /** |
| 101 | 101 | * check the ghamari year is leap or not |
| 102 | 102 | * @since Oct, 24 2015 |
| 103 | - * @return boolean |
|
| 103 | + * @return integer|null |
|
| 104 | 104 | */ |
| 105 | 105 | public function ghamariLeapYear() { |
| 106 | 106 | |
@@ -341,6 +341,10 @@ |
||
| 341 | 341 | return $file; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | + /** |
|
| 345 | + * @param string $class |
|
| 346 | + * @param string $ext |
|
| 347 | + */ |
|
| 344 | 348 | private function findFileWithExtension($class, $ext) |
| 345 | 349 | { |
| 346 | 350 | // PSR-4 lookup |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | /** |
| 144 | 144 | * Get current datetime |
| 145 | 145 | * @since Aug 17 2015 |
| 146 | - * @return object |
|
| 146 | + * @return Datium |
|
| 147 | 147 | */ |
| 148 | 148 | public static function now() { |
| 149 | 149 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param $hour integer |
| 162 | 162 | * @param $minute integer |
| 163 | 163 | * @param $second integer |
| 164 | - * @return object |
|
| 164 | + * @return Datium |
|
| 165 | 165 | */ |
| 166 | 166 | public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) { |
| 167 | 167 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | /** |
| 231 | 231 | * Add new date value to current date |
| 232 | 232 | * @param $value string |
| 233 | - * @return object |
|
| 233 | + * @return Datium |
|
| 234 | 234 | */ |
| 235 | 235 | public function add( $value ) { |
| 236 | 236 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | /** |
| 248 | 248 | * Sub date from current date |
| 249 | 249 | * @param $value |
| 250 | - * @return obejct |
|
| 250 | + * @return Datium |
|
| 251 | 251 | */ |
| 252 | 252 | public function sub( $value ) { |
| 253 | 253 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | /** |
| 265 | 265 | * Check if current year is leap or not |
| 266 | - * @return boolean |
|
| 266 | + * @return Leap |
|
| 267 | 267 | */ |
| 268 | 268 | public function leap( $type = 'gregorian') { |
| 269 | 269 | |
@@ -137,7 +137,9 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | foreach( $config['month_days_number'] as $_month => $value ) { |
| 139 | 139 | |
| 140 | - if ( $_month < $month ) $result += $value; |
|
| 140 | + if ( $_month < $month ) { |
|
| 141 | + $result += $value; |
|
| 142 | + } |
|
| 141 | 143 | |
| 142 | 144 | } |
| 143 | 145 | |
@@ -155,7 +157,9 @@ discard block |
||
| 155 | 157 | |
| 156 | 158 | foreach ($config['days_of_week'] as $key => $value) { |
| 157 | 159 | |
| 158 | - if ( $value == $day ) return $key += 1; |
|
| 160 | + if ( $value == $day ) { |
|
| 161 | + return $key += 1; |
|
| 162 | + } |
|
| 159 | 163 | |
| 160 | 164 | } |
| 161 | 165 | |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $leap = new Datium\Tools\Leap( $year ); |
| 36 | 36 | |
| 37 | - if( $leap->get() && $month > 11 ) $temp_day++; |
|
| 37 | + if( $leap->get() && $month > 11 ) { |
|
| 38 | + $temp_day++; |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
| 40 | 42 | |
@@ -110,7 +112,9 @@ discard block |
||
| 110 | 112 | |
| 111 | 113 | foreach ( $config['month_days_number'] as $month => $value ) { |
| 112 | 114 | |
| 113 | - if( $month > $month ) $days_of_year += $value; |
|
| 115 | + if( $month > $month ) { |
|
| 116 | + $days_of_year += $value; |
|
| 117 | + } |
|
| 114 | 118 | |
| 115 | 119 | } |
| 116 | 120 | |
@@ -51,17 +51,19 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $leap = new Leap( $year ); |
| 53 | 53 | |
| 54 | - if ( $leap->get() && $month > 2 ) $temp_day++; |
|
| 54 | + if ( $leap->get() && $month > 2 ) { |
|
| 55 | + $temp_day++; |
|
| 56 | + } |
|
| 55 | 57 | |
| 56 | 58 | if ( $temp_day <= 79 ) { |
| 57 | 59 | |
| 58 | - if ( ( $year - 1 ) % 4 == 0 ) |
|
| 59 | - |
|
| 60 | + if ( ( $year - 1 ) % 4 == 0 ) { |
|
| 61 | + |
|
| 60 | 62 | $temp_day = $temp_day + 11; |
| 61 | - |
|
| 62 | - else |
|
| 63 | - |
|
| 63 | + } else { |
|
| 64 | + |
|
| 64 | 65 | $temp_day = $temp_day + 10; |
| 66 | + } |
|
| 65 | 67 | |
| 66 | 68 | $year = $year - 622; |
| 67 | 69 | |
@@ -71,9 +73,7 @@ discard block |
||
| 71 | 73 | |
| 72 | 74 | $day = 30; |
| 73 | 75 | |
| 74 | - } |
|
| 75 | - |
|
| 76 | - else { |
|
| 76 | + } else { |
|
| 77 | 77 | |
| 78 | 78 | $month = ( $temp_day / 30 ) + 10; |
| 79 | 79 | |
@@ -81,9 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - } |
|
| 85 | - |
|
| 86 | - else { |
|
| 84 | + } else { |
|
| 87 | 85 | |
| 88 | 86 | $year = $year - 621; |
| 89 | 87 | |
@@ -96,18 +94,14 @@ discard block |
||
| 96 | 94 | $month = ( $temp_day / 31 ); |
| 97 | 95 | |
| 98 | 96 | $day = 31; |
| 99 | - } |
|
| 100 | - |
|
| 101 | - else { |
|
| 97 | + } else { |
|
| 102 | 98 | |
| 103 | 99 | $month = ( $temp_day / 31 ) + 1; |
| 104 | 100 | |
| 105 | 101 | $day = ( $temp_day % 31 ); |
| 106 | 102 | } |
| 107 | 103 | |
| 108 | - } |
|
| 109 | - |
|
| 110 | - else { |
|
| 104 | + } else { |
|
| 111 | 105 | |
| 112 | 106 | $temp_day = $temp_day - 186; |
| 113 | 107 | |
@@ -117,9 +111,7 @@ discard block |
||
| 117 | 111 | |
| 118 | 112 | $day = 30; |
| 119 | 113 | |
| 120 | - } |
|
| 121 | - |
|
| 122 | - else { |
|
| 114 | + } else { |
|
| 123 | 115 | |
| 124 | 116 | $month = ( $temp_day / 30 ) + 7; |
| 125 | 117 | |
@@ -159,7 +151,9 @@ discard block |
||
| 159 | 151 | |
| 160 | 152 | foreach ( $config[ 'month_days_number' ] as $mon => $value ) { |
| 161 | 153 | |
| 162 | - if ( $month > $mon ) $days_of_year += $value; |
|
| 154 | + if ( $month > $mon ) { |
|
| 155 | + $days_of_year += $value; |
|
| 156 | + } |
|
| 163 | 157 | |
| 164 | 158 | } |
| 165 | 159 | |
@@ -175,9 +169,7 @@ discard block |
||
| 175 | 169 | |
| 176 | 170 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 621 ) / 4 ) ); |
| 177 | 171 | |
| 178 | - } |
|
| 179 | - |
|
| 180 | - elseif ( ( ( 10 == $month ) && ( $day > 10 ) ) || ( $month > 10 ) ) { |
|
| 172 | + } elseif ( ( ( 10 == $month ) && ( $day > 10 ) ) || ( $month > 10 ) ) { |
|
| 181 | 173 | |
| 182 | 174 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 622 ) / 4 ) ); |
| 183 | 175 | |
@@ -191,7 +183,9 @@ discard block |
||
| 191 | 183 | |
| 192 | 184 | foreach ( $config[ 'month_days_number' ] as $month => $value ) { |
| 193 | 185 | |
| 194 | - if ( $gregorian_month < $value ) break; |
|
| 186 | + if ( $gregorian_month < $value ) { |
|
| 187 | + break; |
|
| 188 | + } |
|
| 195 | 189 | |
| 196 | 190 | $gregorian_month -= $value; |
| 197 | 191 | } |
@@ -311,7 +305,9 @@ discard block |
||
| 311 | 305 | |
| 312 | 306 | foreach( $config[ 'month_days_number' ] as $_month => $value ) { |
| 313 | 307 | |
| 314 | - if ( $_month < $month ) $result += $value; |
|
| 308 | + if ( $_month < $month ) { |
|
| 309 | + $result += $value; |
|
| 310 | + } |
|
| 315 | 311 | |
| 316 | 312 | } |
| 317 | 313 | |