@@ -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 ) { |
@@ -125,17 +125,19 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $this->leap = new leap( $this->year ); |
| 127 | 127 | |
| 128 | - if( $this->leap->get() && $this->month > 2 ) $this->temp_day++; |
|
| 128 | + if( $this->leap->get() && $this->month > 2 ) { |
|
| 129 | + $this->temp_day++; |
|
| 130 | + } |
|
| 129 | 131 | |
| 130 | 132 | if ( $this->temp_day <= 79 ) { |
| 131 | 133 | |
| 132 | - if( ( $this->year - 1 ) % 4 == 0 ) |
|
| 133 | - |
|
| 134 | + if( ( $this->year - 1 ) % 4 == 0 ) { |
|
| 135 | + |
|
| 134 | 136 | $this->temp_day = $this->temp_day + 11; |
| 135 | - |
|
| 136 | - else |
|
| 137 | - |
|
| 137 | + } else { |
|
| 138 | + |
|
| 138 | 139 | $this->temp_day = $this->temp_day + 10; |
| 140 | + } |
|
| 139 | 141 | |
| 140 | 142 | $this->year = $this->year - 622; |
| 141 | 143 | |
@@ -145,9 +147,7 @@ discard block |
||
| 145 | 147 | |
| 146 | 148 | $this->day = 30; |
| 147 | 149 | |
| 148 | - } |
|
| 149 | - |
|
| 150 | - else { |
|
| 150 | + } else { |
|
| 151 | 151 | |
| 152 | 152 | $this->month = ( $this->temp_day / 30 ) + 10; |
| 153 | 153 | |
@@ -155,9 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - } |
|
| 159 | - |
|
| 160 | - else { |
|
| 158 | + } else { |
|
| 161 | 159 | |
| 162 | 160 | $this->year = $this->year - 621; |
| 163 | 161 | |
@@ -170,18 +168,14 @@ discard block |
||
| 170 | 168 | $this->month = ( $this->temp_day / 31 ); |
| 171 | 169 | |
| 172 | 170 | $this->day = 31; |
| 173 | - } |
|
| 174 | - |
|
| 175 | - else { |
|
| 171 | + } else { |
|
| 176 | 172 | |
| 177 | 173 | $this->month = ( $this->temp_day / 31 ) + 1; |
| 178 | 174 | |
| 179 | 175 | $this->day = ( $this->temp_day % 31 ); |
| 180 | 176 | } |
| 181 | 177 | |
| 182 | - } |
|
| 183 | - |
|
| 184 | - else { |
|
| 178 | + } else { |
|
| 185 | 179 | |
| 186 | 180 | $this->temp_day = $this->temp_day - 186; |
| 187 | 181 | |
@@ -191,9 +185,7 @@ discard block |
||
| 191 | 185 | |
| 192 | 186 | $this->day = 30; |
| 193 | 187 | |
| 194 | - } |
|
| 195 | - |
|
| 196 | - else { |
|
| 188 | + } else { |
|
| 197 | 189 | |
| 198 | 190 | $this->month = ( $this->temp_day / 30 ) + 7; |
| 199 | 191 | |
@@ -240,7 +232,9 @@ discard block |
||
| 240 | 232 | |
| 241 | 233 | $this->leap = new leap( $this->year ); |
| 242 | 234 | |
| 243 | - if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
| 235 | + if( $this->leap->get() && $this->month > 11 ) { |
|
| 236 | + $this->temp_day++; |
|
| 237 | + } |
|
| 244 | 238 | |
| 245 | 239 | $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
| 246 | 240 | |
@@ -314,7 +308,9 @@ discard block |
||
| 314 | 308 | |
| 315 | 309 | foreach ( $this->config['shamsi_month_days'] as $month => $value ) { |
| 316 | 310 | |
| 317 | - if( $this->month > $month ) $days_of_year += $value; |
|
| 311 | + if( $this->month > $month ) { |
|
| 312 | + $days_of_year += $value; |
|
| 313 | + } |
|
| 318 | 314 | |
| 319 | 315 | } |
| 320 | 316 | |
@@ -330,9 +326,7 @@ discard block |
||
| 330 | 326 | |
| 331 | 327 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 621 ) / 4 ) ); |
| 332 | 328 | |
| 333 | -} |
|
| 334 | - |
|
| 335 | -elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
| 329 | +} elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
| 336 | 330 | |
| 337 | 331 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 622 ) / 4 ) ); |
| 338 | 332 | |
@@ -344,7 +338,9 @@ discard block |
||
| 344 | 338 | |
| 345 | 339 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
| 346 | 340 | |
| 347 | - if ( $gregorian_month < $value ) break; |
|
| 341 | + if ( $gregorian_month < $value ) { |
|
| 342 | + break; |
|
| 343 | + } |
|
| 348 | 344 | |
| 349 | 345 | $gregorian_month -= $value; |
| 350 | 346 | } |
@@ -387,7 +383,9 @@ discard block |
||
| 387 | 383 | |
| 388 | 384 | $this->leap = new leap( $this->year ); |
| 389 | 385 | |
| 390 | - if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
| 386 | + if( $this->leap->get() && $this->month > 11 ) { |
|
| 387 | + $this->temp_day++; |
|
| 388 | + } |
|
| 391 | 389 | |
| 392 | 390 | $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
| 393 | 391 | |
@@ -460,7 +458,9 @@ discard block |
||
| 460 | 458 | |
| 461 | 459 | foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
| 462 | 460 | |
| 463 | - if( $this->month > $month ) $days_of_year += $value; |
|
| 461 | + if( $this->month > $month ) { |
|
| 462 | + $days_of_year += $value; |
|
| 463 | + } |
|
| 464 | 464 | |
| 465 | 465 | } |
| 466 | 466 | |
@@ -480,7 +480,9 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | foreach ($this->config['shamsi_month_days'] as $month => $value) { |
| 482 | 482 | |
| 483 | - if ( $shamsi_month < $value ) break; |
|
| 483 | + if ( $shamsi_month < $value ) { |
|
| 484 | + break; |
|
| 485 | + } |
|
| 484 | 486 | |
| 485 | 487 | $shamsi_month -= $value; |
| 486 | 488 | } |
@@ -514,7 +516,9 @@ discard block |
||
| 514 | 516 | |
| 515 | 517 | foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
| 516 | 518 | |
| 517 | - if( $this->month > $month ) $days_of_year += $value; |
|
| 519 | + if( $this->month > $month ) { |
|
| 520 | + $days_of_year += $value; |
|
| 521 | + } |
|
| 518 | 522 | |
| 519 | 523 | } |
| 520 | 524 | |
@@ -534,7 +538,9 @@ discard block |
||
| 534 | 538 | |
| 535 | 539 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
| 536 | 540 | |
| 537 | - if ( $gregorian_month < $value ) break; |
|
| 541 | + if ( $gregorian_month < $value ) { |
|
| 542 | + break; |
|
| 543 | + } |
|
| 538 | 544 | |
| 539 | 545 | $gregorian_month -= $value; |
| 540 | 546 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * Get current datetime |
| 110 | 110 | * @since Aug 17 2015 |
| 111 | - * @return object |
|
| 111 | + * @return Datium |
|
| 112 | 112 | */ |
| 113 | 113 | public static function now() { |
| 114 | 114 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param $hour integer |
| 127 | 127 | * @param $minute integer |
| 128 | 128 | * @param $second integer |
| 129 | - * @return object |
|
| 129 | + * @return Datium |
|
| 130 | 130 | */ |
| 131 | 131 | public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) { |
| 132 | 132 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | /** |
| 189 | 189 | * Add new date value to current date |
| 190 | 190 | * @param $value string |
| 191 | - * @return object |
|
| 191 | + * @return Datium |
|
| 192 | 192 | */ |
| 193 | 193 | public function add( $value ) { |
| 194 | 194 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * Check if current year is leap or not |
| 224 | - * @return boolean |
|
| 224 | + * @return Leap |
|
| 225 | 225 | */ |
| 226 | 226 | public function leap( $type = 'gr') { |
| 227 | 227 | |
@@ -261,6 +261,10 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | + /** |
|
| 265 | + * @param string $calendar |
|
| 266 | + * @param string $format |
|
| 267 | + */ |
|
| 264 | 268 | public function translate( $calendar, $format ) { |
| 265 | 269 | |
| 266 | 270 | $this->date_time = new Translate( $this->date_time, $calendar, $format, $this->gregorian_DayofWeek ); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * @since Sept, 14 2015 |
| 73 | - * @return integer |
|
| 73 | + * @return double |
|
| 74 | 74 | */ |
| 75 | 75 | protected function persian_day_of_year() { |
| 76 | 76 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * @since Sept, 14 2015 |
| 96 | - * @return integer |
|
| 96 | + * @return double |
|
| 97 | 97 | */ |
| 98 | 98 | protected function islamic_day_of_year() { |
| 99 | 99 | |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | foreach( $this->config['shamsi_month_days'] as $month => $value ) { |
| 82 | 82 | |
| 83 | - if ( $month < $this->month ) $this->result += $value; |
|
| 83 | + if ( $month < $this->month ) { |
|
| 84 | + $this->result += $value; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | } |
| 86 | 88 | |
@@ -103,7 +105,9 @@ discard block |
||
| 103 | 105 | |
| 104 | 106 | foreach( $this->config['islamic_month_days'] as $month => $value ) { |
| 105 | 107 | |
| 106 | - if ( $month < $this->month ) $this->result += $value; |
|
| 108 | + if ( $month < $this->month ) { |
|
| 109 | + $this->result += $value; |
|
| 110 | + } |
|
| 107 | 111 | |
| 108 | 112 | } |
| 109 | 113 | |
@@ -155,7 +159,9 @@ discard block |
||
| 155 | 159 | |
| 156 | 160 | foreach ( $this->config['week_days_name']['persian'] as $key => $value ) { |
| 157 | 161 | |
| 158 | - if( $value == $this->day ) return $key += 1; |
|
| 162 | + if( $value == $this->day ) { |
|
| 163 | + return $key += 1; |
|
| 164 | + } |
|
| 159 | 165 | |
| 160 | 166 | } |
| 161 | 167 | |
@@ -171,7 +177,9 @@ discard block |
||
| 171 | 177 | |
| 172 | 178 | foreach ( $this->config['week_days_name']['islamic'] as $key => $value ) { |
| 173 | 179 | |
| 174 | - if( $value == $this->day ) return $key += 1; |
|
| 180 | + if( $value == $this->day ) { |
|
| 181 | + return $key += 1; |
|
| 182 | + } |
|
| 175 | 183 | |
| 176 | 184 | } |
| 177 | 185 | |
@@ -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 | |
@@ -20,6 +20,9 @@ |
||
| 20 | 20 | |
| 21 | 21 | protected $english_number = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ); |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param \DateTime $date_time |
|
| 25 | + */ |
|
| 23 | 26 | public function __construct( $date_time, $calendar, $format, $gregorian_DayofWeek ){ |
| 24 | 27 | |
| 25 | 28 | $this->translate = include( 'lang/fa/general.php' ); |