@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php namespace Datium; |
| 2 | 2 | |
| 3 | 3 | use Datium\Tools\Convert; |
| 4 | -use Datium\Tools\DayOf; |
|
| 5 | 4 | use DateTime; |
| 6 | 5 | use DateInterval; |
| 7 | 6 | use DatePeriod; |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | 4 | |
| 5 | - 'events' => array( 'nowruz' => 'عید نوروز', |
|
| 5 | + 'events' => array( 'nowruz' => 'عید نوروز', |
|
| 6 | 6 | |
| 7 | 7 | 'iran_national_day' => 'روز جمهوری اسلامی', |
| 8 | 8 | |
@@ -12,16 +12,16 @@ discard block |
||
| 12 | 12 | 'month' => array( |
| 13 | 13 | 'فروردین', |
| 14 | 14 | 'اردیبهشت', |
| 15 | - 'خرداد', |
|
| 16 | - 'تیر', |
|
| 17 | - 'مرداد', |
|
| 18 | - 'شهریور', |
|
| 19 | - 'مهر', |
|
| 20 | - 'آبان', |
|
| 21 | - 'آذر', |
|
| 22 | - 'دی', |
|
| 23 | - 'بهمن', |
|
| 24 | - 'اسفند', |
|
| 15 | + 'خرداد', |
|
| 16 | + 'تیر', |
|
| 17 | + 'مرداد', |
|
| 18 | + 'شهریور', |
|
| 19 | + 'مهر', |
|
| 20 | + 'آبان', |
|
| 21 | + 'آذر', |
|
| 22 | + 'دی', |
|
| 23 | + 'بهمن', |
|
| 24 | + 'اسفند', |
|
| 25 | 25 | ), |
| 26 | 26 | |
| 27 | 27 | 'week_days_name' => array( |
@@ -125,4 +125,4 @@ |
||
| 125 | 125 | */ |
| 126 | 126 | 'weekend' => array( 'friday' ) |
| 127 | 127 | |
| 128 | - ); |
|
| 128 | + ); |
|
@@ -2,23 +2,23 @@ |
||
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | 4 | |
| 5 | - 'events' => array( 'eid fitr' => 'عيد الفطر', |
|
| 5 | + 'events' => array( 'eid fitr' => 'عيد الفطر', |
|
| 6 | 6 | |
| 7 | 7 | ), |
| 8 | 8 | |
| 9 | 9 | 'month' => array( |
| 10 | 10 | 'مُحَرَّم', |
| 11 | 11 | 'صَفَر', |
| 12 | - 'رَبيع الأوّل', |
|
| 13 | - 'رَبيع الآخر', |
|
| 14 | - 'جُمادى الأولى', |
|
| 15 | - 'جُمادى الآخرة', |
|
| 16 | - 'رَجَب', |
|
| 17 | - 'شَعْبان', |
|
| 18 | - 'رَمَضان', |
|
| 19 | - 'شَوّال', |
|
| 20 | - 'ذو القِعْدة', |
|
| 21 | - 'ذو الحِجّة' |
|
| 12 | + 'رَبيع الأوّل', |
|
| 13 | + 'رَبيع الآخر', |
|
| 14 | + 'جُمادى الأولى', |
|
| 15 | + 'جُمادى الآخرة', |
|
| 16 | + 'رَجَب', |
|
| 17 | + 'شَعْبان', |
|
| 18 | + 'رَمَضان', |
|
| 19 | + 'شَوّال', |
|
| 20 | + 'ذو القِعْدة', |
|
| 21 | + 'ذو الحِجّة' |
|
| 22 | 22 | ), |
| 23 | 23 | |
| 24 | 24 | 'days_of_week' => array( |
@@ -1,7 +1,5 @@ |
||
| 1 | 1 | ``<?php |
| 2 | 2 | |
| 3 | - use OpenCafe\Datium as Datium; |
|
| 4 | - |
|
| 5 | 3 | return array ( |
| 6 | 4 | |
| 7 | 5 | 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use OpenCafe\Datium as Datium; |
|
| 3 | + use OpenCafe\Datium as Datium; |
|
| 4 | 4 | |
| 5 | - return [ |
|
| 5 | + return [ |
|
| 6 | 6 | |
| 7 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 7 | + 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 8 | 8 | |
| 9 | - 'am_time' => 'AM', |
|
| 9 | + 'am_time' => 'AM', |
|
| 10 | 10 | |
| 11 | - 'pm_time' => 'PM', |
|
| 11 | + 'pm_time' => 'PM', |
|
| 12 | 12 | |
| 13 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 13 | + 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | |
| 17 | - /************************************************************ |
|
| 17 | + /************************************************************ |
|
| 18 | 18 | * Convert to |
| 19 | 19 | ************************************************************ |
| 20 | 20 | * |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | *\_________________________________________________________/ |
| 24 | 24 | */ |
| 25 | - 'convert_to' => function ($date_time) { |
|
| 25 | + 'convert_to' => function ($date_time) { |
|
| 26 | 26 | |
| 27 | - return null; |
|
| 27 | + return null; |
|
| 28 | 28 | |
| 29 | - }, |
|
| 29 | + }, |
|
| 30 | 30 | |
| 31 | 31 | /************************************************************ |
| 32 | 32 | * Convert From |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | 'December' |
| 88 | 88 | |
| 89 | - ), |
|
| 89 | + ), |
|
| 90 | 90 | |
| 91 | 91 | /************************************************************ |
| 92 | 92 | * Days of Week |
@@ -99,28 +99,28 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | 'days_of_week' => array ( |
| 101 | 101 | |
| 102 | - 'Monday', |
|
| 103 | - 'Tuesday', |
|
| 104 | - 'Wednesday', |
|
| 105 | - 'Thursday', |
|
| 106 | - 'Friday', |
|
| 107 | - 'Saturday', |
|
| 108 | - 'Sunday', |
|
| 102 | + 'Monday', |
|
| 103 | + 'Tuesday', |
|
| 104 | + 'Wednesday', |
|
| 105 | + 'Thursday', |
|
| 106 | + 'Friday', |
|
| 107 | + 'Saturday', |
|
| 108 | + 'Sunday', |
|
| 109 | 109 | ), |
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | 'month_days_number' => array( 1 => 31, |
| 113 | - 2 => 28, |
|
| 114 | - 3 => 31, |
|
| 115 | - 4 => 30, |
|
| 116 | - 5 => 31, |
|
| 117 | - 6 => 30, |
|
| 118 | - 7 => 31, |
|
| 119 | - 8 => 31, |
|
| 120 | - 9 => 30, |
|
| 121 | - 10 => 31, |
|
| 122 | - 11 => 30, |
|
| 123 | - 12 => 30 ), |
|
| 113 | + 2 => 28, |
|
| 114 | + 3 => 31, |
|
| 115 | + 4 => 30, |
|
| 116 | + 5 => 31, |
|
| 117 | + 6 => 30, |
|
| 118 | + 7 => 31, |
|
| 119 | + 8 => 31, |
|
| 120 | + 9 => 30, |
|
| 121 | + 10 => 31, |
|
| 122 | + 11 => 30, |
|
| 123 | + 12 => 30 ), |
|
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | 'day_of_year' => function ($date_time) { |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | use OpenCafe\Tools\Leap; |
| 19 | 19 | use OpenCafe\Tools\DayOf; |
| 20 | 20 | use OpenCafe\Tools\Lang; |
| 21 | - |
|
| 22 | 21 | use OpenCafe\Datium; |
| 23 | 22 | |
| 24 | 23 | /** |
@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * Store DateTime object |
|
| 40 | - */ |
|
| 39 | + * Store DateTime object |
|
| 40 | + */ |
|
| 41 | 41 | protected $date_time; |
| 42 | 42 | |
| 43 | 43 | protected static $static_date_time; |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * Store config file statements |
|
| 47 | - * |
|
| 48 | - * @param array |
|
| 49 | - */ |
|
| 46 | + * Store config file statements |
|
| 47 | + * |
|
| 48 | + * @param array |
|
| 49 | + */ |
|
| 50 | 50 | protected $config; |
| 51 | 51 | |
| 52 | 52 | protected $date_interval_expression; |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | protected $fromConfig; |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * Return store day number |
|
| 68 | - * |
|
| 69 | - * @param integer |
|
| 70 | - */ |
|
| 67 | + * Return store day number |
|
| 68 | + * |
|
| 69 | + * @param integer |
|
| 70 | + */ |
|
| 71 | 71 | protected $day_of; |
| 72 | 72 | |
| 73 | 73 | protected $leap; |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | protected $language; |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * Timeago |
|
| 97 | - * |
|
| 98 | - * @param integer |
|
| 99 | - */ |
|
| 96 | + * Timeago |
|
| 97 | + * |
|
| 98 | + * @param integer |
|
| 99 | + */ |
|
| 100 | 100 | protected $ago; |
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | - * Datium class constructure |
|
| 104 | - */ |
|
| 103 | + * Datium class constructure |
|
| 104 | + */ |
|
| 105 | 105 | public function __construct() |
| 106 | 106 | { |
| 107 | 107 | |
@@ -157,10 +157,10 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | - * Return all datetime parts as an object |
|
| 161 | - * |
|
| 162 | - * @return object |
|
| 163 | - */ |
|
| 160 | + * Return all datetime parts as an object |
|
| 161 | + * |
|
| 162 | + * @return object |
|
| 163 | + */ |
|
| 164 | 164 | public function all() |
| 165 | 165 | { |
| 166 | 166 | |
@@ -183,11 +183,11 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | - * Get current datetime |
|
| 187 | - * |
|
| 188 | - * @since Aug 17 2015 |
|
| 189 | - * @return object |
|
| 190 | - */ |
|
| 186 | + * Get current datetime |
|
| 187 | + * |
|
| 188 | + * @since Aug 17 2015 |
|
| 189 | + * @return object |
|
| 190 | + */ |
|
| 191 | 191 | public static function now() |
| 192 | 192 | { |
| 193 | 193 | |
@@ -198,17 +198,17 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | - * Create new date time |
|
| 202 | - * |
|
| 203 | - * @param integer $year Year number |
|
| 204 | - * @param integer $month month number |
|
| 205 | - * @param integer $day day number |
|
| 206 | - * @param integer $hour hour number |
|
| 207 | - * @param integer $minute minute number |
|
| 208 | - * @param integer $second second number |
|
| 209 | - * |
|
| 210 | - * @return object |
|
| 211 | - */ |
|
| 201 | + * Create new date time |
|
| 202 | + * |
|
| 203 | + * @param integer $year Year number |
|
| 204 | + * @param integer $month month number |
|
| 205 | + * @param integer $day day number |
|
| 206 | + * @param integer $hour hour number |
|
| 207 | + * @param integer $minute minute number |
|
| 208 | + * @param integer $second second number |
|
| 209 | + * |
|
| 210 | + * @return object |
|
| 211 | + */ |
|
| 212 | 212 | public static function create( |
| 213 | 213 | $year = 2000, |
| 214 | 214 | $month = 1, |
@@ -220,8 +220,8 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | - * When we want to set a Datetime object to Datium |
|
| 224 | - */ |
|
| 223 | + * When we want to set a Datetime object to Datium |
|
| 224 | + */ |
|
| 225 | 225 | if (func_num_args() === 1) { |
| 226 | 226 | self::$static_date_time = func_get_arg(0); |
| 227 | 227 | |
@@ -244,13 +244,13 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | - * Select The range between two date object |
|
| 248 | - * |
|
| 249 | - * @param object $date_start Start of the DateTime |
|
| 250 | - * @param object $date_end End of the DateTime |
|
| 251 | - * |
|
| 252 | - * @return object |
|
| 253 | - */ |
|
| 247 | + * Select The range between two date object |
|
| 248 | + * |
|
| 249 | + * @param object $date_start Start of the DateTime |
|
| 250 | + * @param object $date_end End of the DateTime |
|
| 251 | + * |
|
| 252 | + * @return object |
|
| 253 | + */ |
|
| 254 | 254 | public static function between($date_start, $date_end) |
| 255 | 255 | { |
| 256 | 256 | |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | - * Convert from current calendar, what type is current calendar? |
|
| 269 | - * |
|
| 270 | - * @param object $calendar Assigned calendar to start from |
|
| 271 | - * |
|
| 272 | - * @return $object |
|
| 273 | - */ |
|
| 268 | + * Convert from current calendar, what type is current calendar? |
|
| 269 | + * |
|
| 270 | + * @param object $calendar Assigned calendar to start from |
|
| 271 | + * |
|
| 272 | + * @return $object |
|
| 273 | + */ |
|
| 274 | 274 | public function from($calendar) |
| 275 | 275 | { |
| 276 | 276 | |
@@ -280,8 +280,8 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | |
| 282 | 282 | /** |
| 283 | - * We need this part for DayOf class |
|
| 284 | - */ |
|
| 283 | + * We need this part for DayOf class |
|
| 284 | + */ |
|
| 285 | 285 | $this->calendar_type = $calendar; |
| 286 | 286 | |
| 287 | 287 | $this->translate_to = $calendar; |
@@ -291,12 +291,12 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | - * Convert date to current Date |
|
| 295 | - * |
|
| 296 | - * @param object $calendar Assigned calendar to when calendar should start. |
|
| 297 | - * |
|
| 298 | - * @return object |
|
| 299 | - */ |
|
| 294 | + * Convert date to current Date |
|
| 295 | + * |
|
| 296 | + * @param object $calendar Assigned calendar to when calendar should start. |
|
| 297 | + * |
|
| 298 | + * @return object |
|
| 299 | + */ |
|
| 300 | 300 | public function to($calendar) |
| 301 | 301 | { |
| 302 | 302 | |
@@ -305,8 +305,8 @@ discard block |
||
| 305 | 305 | $this->date_time = $this->convert->to($calendar); |
| 306 | 306 | |
| 307 | 307 | /** |
| 308 | - * We need this part for DayOf class |
|
| 309 | - */ |
|
| 308 | + * We need this part for DayOf class |
|
| 309 | + */ |
|
| 310 | 310 | $this->calendar_type = $calendar; |
| 311 | 311 | |
| 312 | 312 | $this->translate_to = $calendar; |
@@ -316,13 +316,13 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
| 319 | - * Difference between two time |
|
| 320 | - * |
|
| 321 | - * @param DateTime $start Start of the date |
|
| 322 | - * @param DateTime $end End of the date |
|
| 323 | - * |
|
| 324 | - * @return object |
|
| 325 | - */ |
|
| 319 | + * Difference between two time |
|
| 320 | + * |
|
| 321 | + * @param DateTime $start Start of the date |
|
| 322 | + * @param DateTime $end End of the date |
|
| 323 | + * |
|
| 324 | + * @return object |
|
| 325 | + */ |
|
| 326 | 326 | public static function diff($start, $end) |
| 327 | 327 | { |
| 328 | 328 | |
@@ -331,12 +331,12 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
| 334 | - * Add new date value to current date |
|
| 335 | - * |
|
| 336 | - * @param string $value How much date should be added to current date |
|
| 337 | - * |
|
| 338 | - * @return object |
|
| 339 | - */ |
|
| 334 | + * Add new date value to current date |
|
| 335 | + * |
|
| 336 | + * @param string $value How much date should be added to current date |
|
| 337 | + * |
|
| 338 | + * @return object |
|
| 339 | + */ |
|
| 340 | 340 | public function add($value) |
| 341 | 341 | { |
| 342 | 342 | |
@@ -375,12 +375,12 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
| 378 | - * Sub date from current date |
|
| 379 | - * |
|
| 380 | - * @param string $value How much date should increase from current date |
|
| 381 | - * |
|
| 382 | - * @return obejct |
|
| 383 | - */ |
|
| 378 | + * Sub date from current date |
|
| 379 | + * |
|
| 380 | + * @param string $value How much date should increase from current date |
|
| 381 | + * |
|
| 382 | + * @return obejct |
|
| 383 | + */ |
|
| 384 | 384 | public function sub($value) |
| 385 | 385 | { |
| 386 | 386 | |
@@ -419,12 +419,12 @@ discard block |
||
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /** |
| 422 | - * Check if current year is leap or not |
|
| 423 | - * |
|
| 424 | - * @param string $type Name of the calendar to caculate leap year |
|
| 425 | - * |
|
| 426 | - * @return boolean |
|
| 427 | - */ |
|
| 422 | + * Check if current year is leap or not |
|
| 423 | + * |
|
| 424 | + * @param string $type Name of the calendar to caculate leap year |
|
| 425 | + * |
|
| 426 | + * @return boolean |
|
| 427 | + */ |
|
| 428 | 428 | public function leap() |
| 429 | 429 | { |
| 430 | 430 | |
@@ -435,10 +435,10 @@ discard block |
||
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | /** |
| 438 | - * Calculate how many time ago datetime happens |
|
| 439 | - * |
|
| 440 | - * @return string |
|
| 441 | - */ |
|
| 438 | + * Calculate how many time ago datetime happens |
|
| 439 | + * |
|
| 440 | + * @return string |
|
| 441 | + */ |
|
| 442 | 442 | public function ago() |
| 443 | 443 | { |
| 444 | 444 | |
@@ -449,12 +449,12 @@ discard block |
||
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | /** |
| 452 | - * Caculate day of year or week |
|
| 453 | - * |
|
| 454 | - * @since Aug, 22 2015 |
|
| 455 | - * |
|
| 456 | - * @return integer |
|
| 457 | - */ |
|
| 452 | + * Caculate day of year or week |
|
| 453 | + * |
|
| 454 | + * @since Aug, 22 2015 |
|
| 455 | + * |
|
| 456 | + * @return integer |
|
| 457 | + */ |
|
| 458 | 458 | public function dayOf() |
| 459 | 459 | { |
| 460 | 460 | |
@@ -482,12 +482,12 @@ discard block |
||
| 482 | 482 | // } |
| 483 | 483 | |
| 484 | 484 | /** |
| 485 | - * Return Datetime as a original object |
|
| 486 | - * |
|
| 487 | - * @since Oct 22, 2015 |
|
| 488 | - * |
|
| 489 | - * @return object |
|
| 490 | - */ |
|
| 485 | + * Return Datetime as a original object |
|
| 486 | + * |
|
| 487 | + * @since Oct 22, 2015 |
|
| 488 | + * |
|
| 489 | + * @return object |
|
| 490 | + */ |
|
| 491 | 491 | public function object() |
| 492 | 492 | { |
| 493 | 493 | |
@@ -496,12 +496,12 @@ discard block |
||
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | /** |
| 499 | - * Translate current date string to selected language |
|
| 500 | - * |
|
| 501 | - * @param string $language language short name fa, en, ar ... |
|
| 502 | - * |
|
| 503 | - * @return object |
|
| 504 | - */ |
|
| 499 | + * Translate current date string to selected language |
|
| 500 | + * |
|
| 501 | + * @param string $language language short name fa, en, ar ... |
|
| 502 | + * |
|
| 503 | + * @return object |
|
| 504 | + */ |
|
| 505 | 505 | public function lang($language = 'fa') |
| 506 | 506 | { |
| 507 | 507 | |
@@ -518,10 +518,10 @@ discard block |
||
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
| 521 | - * Return object as timestamp |
|
| 522 | - * |
|
| 523 | - * @return timestamp |
|
| 524 | - */ |
|
| 521 | + * Return object as timestamp |
|
| 522 | + * |
|
| 523 | + * @return timestamp |
|
| 524 | + */ |
|
| 525 | 525 | public function timestamp() |
| 526 | 526 | { |
| 527 | 527 | |
@@ -530,14 +530,14 @@ discard block |
||
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | /** |
| 533 | - * Return fainal result |
|
| 534 | - * |
|
| 535 | - * @param string $format Date format |
|
| 536 | - * |
|
| 537 | - * @since Aug 17 2015 |
|
| 538 | - * |
|
| 539 | - * @return string |
|
| 540 | - */ |
|
| 533 | + * Return fainal result |
|
| 534 | + * |
|
| 535 | + * @param string $format Date format |
|
| 536 | + * |
|
| 537 | + * @since Aug 17 2015 |
|
| 538 | + * |
|
| 539 | + * @return string |
|
| 540 | + */ |
|
| 541 | 541 | public function get($format = 'Y-m-d H:i:s') |
| 542 | 542 | { |
| 543 | 543 | |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | if (is_null($this->toConfig)) { |
| 555 | 555 | $this->toConfig = include 'CalendarSettings/' . |
| 556 | - ucfirst($this->translate_to) . '.php'; |
|
| 556 | + ucfirst($this->translate_to) . '.php'; |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | $string_date = $this->date_time->format($format); |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * Which day of year is current day. |
|
| 38 | - * |
|
| 39 | - * @since Aug, 03 2015 |
|
| 40 | - * @return integer |
|
| 41 | - */ |
|
| 37 | + * Which day of year is current day. |
|
| 38 | + * |
|
| 39 | + * @since Aug, 03 2015 |
|
| 40 | + * @return integer |
|
| 41 | + */ |
|
| 42 | 42 | public function year() |
| 43 | 43 | { |
| 44 | 44 | |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Which day of week is current day. |
|
| 54 | - * |
|
| 55 | - * @since Aug, 09 2015 |
|
| 56 | - * @return integer |
|
| 57 | - */ |
|
| 53 | + * Which day of week is current day. |
|
| 54 | + * |
|
| 55 | + * @since Aug, 09 2015 |
|
| 56 | + * @return integer |
|
| 57 | + */ |
|
| 58 | 58 | public function week() |
| 59 | 59 | { |
| 60 | 60 | |
@@ -12,48 +12,48 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * @var integer |
|
| 16 | - */ |
|
| 15 | + * @var integer |
|
| 16 | + */ |
|
| 17 | 17 | protected $year; |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @var integer |
|
| 21 | - */ |
|
| 20 | + * @var integer |
|
| 21 | + */ |
|
| 22 | 22 | protected $month; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * @var $day |
|
| 26 | - */ |
|
| 25 | + * @var $day |
|
| 26 | + */ |
|
| 27 | 27 | protected $day; |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * @var DateTime |
|
| 31 | - */ |
|
| 30 | + * @var DateTime |
|
| 31 | + */ |
|
| 32 | 32 | public $date_time; |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * @var array |
|
| 36 | - */ |
|
| 35 | + * @var array |
|
| 36 | + */ |
|
| 37 | 37 | protected $config; |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * @var integer |
|
| 41 | - */ |
|
| 40 | + * @var integer |
|
| 41 | + */ |
|
| 42 | 42 | protected $leap; |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * @var integer |
|
| 46 | - */ |
|
| 45 | + * @var integer |
|
| 46 | + */ |
|
| 47 | 47 | protected $temp_day; |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * @var DateTime |
|
| 51 | - */ |
|
| 50 | + * @var DateTime |
|
| 51 | + */ |
|
| 52 | 52 | protected $date; |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * @var array |
|
| 56 | - */ |
|
| 55 | + * @var array |
|
| 56 | + */ |
|
| 57 | 57 | protected $calendar_file; |
| 58 | 58 | |
| 59 | 59 | /************************************************************ |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | - *convert jalali year to gregorian year |
|
| 108 | - * |
|
| 109 | - * @since Oct, 16 2015 |
|
| 110 | - * @return object |
|
| 111 | - */ |
|
| 107 | + *convert jalali year to gregorian year |
|
| 108 | + * |
|
| 109 | + * @since Oct, 16 2015 |
|
| 110 | + * @return object |
|
| 111 | + */ |
|
| 112 | 112 | public function jalaliToGregorian( $date_time ) |
| 113 | 113 | { |
| 114 | 114 | |
@@ -172,16 +172,16 @@ discard block |
||
| 172 | 172 | $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
| 173 | 173 | |
| 174 | 174 | |
| 175 | - return $this->date_time; |
|
| 175 | + return $this->date_time; |
|
| 176 | 176 | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
| 180 | - *convert jalali year to hijri year |
|
| 181 | - * |
|
| 182 | - * @since Oct, 17 2015 |
|
| 183 | - * @return object |
|
| 184 | - */ |
|
| 180 | + *convert jalali year to hijri year |
|
| 181 | + * |
|
| 182 | + * @since Oct, 17 2015 |
|
| 183 | + * @return object |
|
| 184 | + */ |
|
| 185 | 185 | public function jalaliToHijri( $date_time ) |
| 186 | 186 | { |
| 187 | 187 | |
@@ -203,9 +203,9 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $this->temp_day += $this->day; |
|
| 206 | + $this->temp_day += $this->day; |
|
| 207 | 207 | |
| 208 | - $this->leap = new Leap($this->year); |
|
| 208 | + $this->leap = new Leap($this->year); |
|
| 209 | 209 | |
| 210 | 210 | if ($this->leap->get() && $this->month > 11 ) { $this->temp_day++; |
| 211 | 211 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | $_month = $_year[1]; |
| 220 | 220 | |
| 221 | - $var_temp = '0.0'; |
|
| 221 | + $var_temp = '0.0'; |
|
| 222 | 222 | |
| 223 | 223 | for ( $i = strlen($_month); $i > 2; $i-- ) { |
| 224 | 224 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - $var_temp .= '1'; |
|
| 229 | + $var_temp .= '1'; |
|
| 230 | 230 | |
| 231 | 231 | $_month = $_month * $var_temp ; |
| 232 | 232 | |
@@ -256,18 +256,18 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | $this->day = $_day[0]; |
| 258 | 258 | |
| 259 | - $this->date_time->setDate($this->year, $this->month, $this->day); |
|
| 259 | + $this->date_time->setDate($this->year, $this->month, $this->day); |
|
| 260 | 260 | |
| 261 | - return $this->date_time; |
|
| 261 | + return $this->date_time; |
|
| 262 | 262 | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | - *convert hijri year to jalali year |
|
| 267 | - * |
|
| 268 | - * @since Oct, 17 2015 |
|
| 269 | - * @return object |
|
| 270 | - */ |
|
| 266 | + *convert hijri year to jalali year |
|
| 267 | + * |
|
| 268 | + * @since Oct, 17 2015 |
|
| 269 | + * @return object |
|
| 270 | + */ |
|
| 271 | 271 | public function hijriToJalali( $date_time ) |
| 272 | 272 | { |
| 273 | 273 | |
@@ -320,16 +320,16 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $this->date_time->setDate($jalali_year, $jalali_month, $jalali_day); |
| 322 | 322 | |
| 323 | - return $this->date_time; |
|
| 323 | + return $this->date_time; |
|
| 324 | 324 | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | - * convert hijri year to gregorian year |
|
| 329 | - * |
|
| 330 | - * @since Oct, 17 2015 |
|
| 331 | - * @return object |
|
| 332 | - */ |
|
| 328 | + * convert hijri year to gregorian year |
|
| 329 | + * |
|
| 330 | + * @since Oct, 17 2015 |
|
| 331 | + * @return object |
|
| 332 | + */ |
|
| 333 | 333 | public function hijriToGregorian( $date_time ) |
| 334 | 334 | { |
| 335 | 335 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
| 384 | 384 | |
| 385 | - return $this->date_time; |
|
| 385 | + return $this->date_time; |
|
| 386 | 386 | |
| 387 | 387 | } |
| 388 | 388 | |
@@ -42,13 +42,13 @@ |
||
| 42 | 42 | { |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * Fetch translated file to config attribute |
|
| 46 | - */ |
|
| 45 | + * Fetch translated file to config attribute |
|
| 46 | + */ |
|
| 47 | 47 | self::$config = include 'src/CalendarSettings/Jalali.php'; |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Fetch translated expression to langTable attribute |
|
| 51 | - */ |
|
| 50 | + * Fetch translated expression to langTable attribute |
|
| 51 | + */ |
|
| 52 | 52 | self::$langTable = include 'lang/' . $language . '/general.php'; |
| 53 | 53 | |
| 54 | 54 | foreach( self::$langTable as $key => $translate ){ |