@@ -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 | |
@@ -78,33 +78,33 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $this->translate_to = 'gregorian'; |
| 80 | 80 | |
| 81 | - $this->config = include( 'Config.php' ); |
|
| 81 | + $this->config = include('Config.php'); |
|
| 82 | 82 | |
| 83 | - $this->calendar_type = $this->config[ 'default_calendar' ]; |
|
| 83 | + $this->calendar_type = $this->config['default_calendar']; |
|
| 84 | 84 | |
| 85 | - date_default_timezone_set( $this->config[ 'timezone' ] ); |
|
| 85 | + date_default_timezone_set($this->config['timezone']); |
|
| 86 | 86 | |
| 87 | 87 | $this->calendar_type = 'gregorian'; |
| 88 | 88 | |
| 89 | - switch( Datium::$call_type ) { |
|
| 89 | + switch (Datium::$call_type) { |
|
| 90 | 90 | |
| 91 | 91 | case 'now': |
| 92 | 92 | |
| 93 | - $this->date_time = new DateTime( 'now' ); |
|
| 93 | + $this->date_time = new DateTime('now'); |
|
| 94 | 94 | |
| 95 | - $this->gregorian_DayofWeek = $this->date_time->format( 'w' ); |
|
| 95 | + $this->gregorian_DayofWeek = $this->date_time->format('w'); |
|
| 96 | 96 | |
| 97 | 97 | break; |
| 98 | 98 | |
| 99 | 99 | case 'make': |
| 100 | 100 | |
| 101 | - $this->date_time = new DateTime( 'now' ); |
|
| 101 | + $this->date_time = new DateTime('now'); |
|
| 102 | 102 | |
| 103 | - $this->date_time->setDate( self::$array_date[ 'year' ], self::$array_date[ 'month' ], self::$array_date[ 'day' ] ); |
|
| 103 | + $this->date_time->setDate(self::$array_date['year'], self::$array_date['month'], self::$array_date['day']); |
|
| 104 | 104 | |
| 105 | - $this->date_time->setTime( self::$array_date[ 'hour' ], self::$array_date[ 'minute' ], self::$array_date[ 'second' ] ); |
|
| 105 | + $this->date_time->setTime(self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second']); |
|
| 106 | 106 | |
| 107 | - $this->gregorian_DayofWeek = $this->date_time->format( 'w' ); |
|
| 107 | + $this->gregorian_DayofWeek = $this->date_time->format('w'); |
|
| 108 | 108 | |
| 109 | 109 | break; |
| 110 | 110 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | $this->date_time = Datium::$static_date_time; |
| 114 | 114 | |
| 115 | - $this->gregorian_DayofWeek = $this->date_time->format( 'w' ); |
|
| 115 | + $this->gregorian_DayofWeek = $this->date_time->format('w'); |
|
| 116 | 116 | |
| 117 | 117 | } |
| 118 | 118 | |
@@ -129,19 +129,19 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function all() { |
| 131 | 131 | |
| 132 | - return ( object ) array( |
|
| 132 | + return (object) array( |
|
| 133 | 133 | |
| 134 | - 'second' => $this->date_time->format( 's' ), |
|
| 134 | + 'second' => $this->date_time->format('s'), |
|
| 135 | 135 | |
| 136 | - 'minute' => $this->date_time->format( 'm' ), |
|
| 136 | + 'minute' => $this->date_time->format('m'), |
|
| 137 | 137 | |
| 138 | - 'hour' => $this->date_time->format( 'H' ), |
|
| 138 | + 'hour' => $this->date_time->format('H'), |
|
| 139 | 139 | |
| 140 | - 'day' => $this->date_time->format( 'd' ), |
|
| 140 | + 'day' => $this->date_time->format('d'), |
|
| 141 | 141 | |
| 142 | - 'month' => $this->date_time->format( 'm' ), |
|
| 142 | + 'month' => $this->date_time->format('m'), |
|
| 143 | 143 | |
| 144 | - 'year' => $this->date_time->format( 'Y' ) |
|
| 144 | + 'year' => $this->date_time->format('Y') |
|
| 145 | 145 | |
| 146 | 146 | ); |
| 147 | 147 | |
@@ -170,20 +170,20 @@ discard block |
||
| 170 | 170 | * @param $second integer |
| 171 | 171 | * @return object |
| 172 | 172 | */ |
| 173 | - public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) { |
|
| 173 | + public static function create($year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) { |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * When we want to set a Datetime object to Datium |
| 177 | 177 | */ |
| 178 | - if( func_num_args() === 1 ) { |
|
| 178 | + if (func_num_args() === 1) { |
|
| 179 | 179 | |
| 180 | - self::$static_date_time = func_get_arg( 0 ); |
|
| 180 | + self::$static_date_time = func_get_arg(0); |
|
| 181 | 181 | |
| 182 | 182 | self::$call_type = 'set'; |
| 183 | 183 | |
| 184 | 184 | } else { |
| 185 | 185 | |
| 186 | - self::$array_date = array( 'year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second ); |
|
| 186 | + self::$array_date = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second); |
|
| 187 | 187 | |
| 188 | 188 | self::$call_type = 'make'; |
| 189 | 189 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - public static function between( $date_start, $date_end ) { |
|
| 196 | + public static function between($date_start, $date_end) { |
|
| 197 | 197 | |
| 198 | 198 | self::$date_start = $date_start; |
| 199 | 199 | |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | /** |
| 209 | 209 | * Convert from current calendar, what type is current calendar? |
| 210 | 210 | */ |
| 211 | - public function from( $calendar ) { |
|
| 211 | + public function from($calendar) { |
|
| 212 | 212 | |
| 213 | - $this->convert = new Convert( $this->date_time ); |
|
| 213 | + $this->convert = new Convert($this->date_time); |
|
| 214 | 214 | |
| 215 | - $this->date_time = $this->convert->from( $calendar ); |
|
| 215 | + $this->date_time = $this->convert->from($calendar); |
|
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -226,11 +226,11 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - public function to( $calendar ) { |
|
| 229 | + public function to($calendar) { |
|
| 230 | 230 | |
| 231 | - $this->convert = new Convert( $this->date_time ); |
|
| 231 | + $this->convert = new Convert($this->date_time); |
|
| 232 | 232 | |
| 233 | - $this->date_time = $this->convert->to( $calendar ); |
|
| 233 | + $this->date_time = $this->convert->to($calendar); |
|
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | 236 | * We need this part for DayOf class |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | * @param $start datetime |
| 250 | 250 | * @param $end datetime |
| 251 | 251 | */ |
| 252 | - public static function diff( $start, $end ) { |
|
| 252 | + public static function diff($start, $end) { |
|
| 253 | 253 | |
| 254 | - return date_diff( $start, $end ); |
|
| 254 | + return date_diff($start, $end); |
|
| 255 | 255 | |
| 256 | 256 | } |
| 257 | 257 | |
@@ -260,13 +260,13 @@ discard block |
||
| 260 | 260 | * @param $value string |
| 261 | 261 | * @return object |
| 262 | 262 | */ |
| 263 | - public function add( $value ) { |
|
| 263 | + public function add($value) { |
|
| 264 | 264 | |
| 265 | - $this->date_interval_expression = str_replace( $this->config[ 'date_simple' ], $this->config[ 'date_interval' ], $value ); |
|
| 265 | + $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value); |
|
| 266 | 266 | |
| 267 | - $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression ); |
|
| 267 | + $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression); |
|
| 268 | 268 | |
| 269 | - $this->date_time->add( new DateInterval( $this->date_interval_expression ) ); |
|
| 269 | + $this->date_time->add(new DateInterval($this->date_interval_expression)); |
|
| 270 | 270 | |
| 271 | 271 | return $this; |
| 272 | 272 | |
@@ -277,13 +277,13 @@ discard block |
||
| 277 | 277 | * @param $value |
| 278 | 278 | * @return obejct |
| 279 | 279 | */ |
| 280 | - public function sub( $value ) { |
|
| 280 | + public function sub($value) { |
|
| 281 | 281 | |
| 282 | - $this->date_interval_expression = str_replace( $this->config[ 'date_simple' ], $this->config[ 'date_interval' ], $value ); |
|
| 282 | + $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value); |
|
| 283 | 283 | |
| 284 | - $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression ); |
|
| 284 | + $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression); |
|
| 285 | 285 | |
| 286 | - $this->date_time->sub( new DateInterval( $this->date_interval_expression ) ); |
|
| 286 | + $this->date_time->sub(new DateInterval($this->date_interval_expression)); |
|
| 287 | 287 | |
| 288 | 288 | return $this; |
| 289 | 289 | |
@@ -293,9 +293,9 @@ discard block |
||
| 293 | 293 | * Check if current year is leap or not |
| 294 | 294 | * @return boolean |
| 295 | 295 | */ |
| 296 | - public function leap( $type = 'gregorian' ) { |
|
| 296 | + public function leap($type = 'gregorian') { |
|
| 297 | 297 | |
| 298 | - $this->leap = new Leap( $this->date_time->format( 'Y' ), $type ); |
|
| 298 | + $this->leap = new Leap($this->date_time->format('Y'), $type); |
|
| 299 | 299 | |
| 300 | 300 | return $this->leap; |
| 301 | 301 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | public function dayOf() { |
| 308 | 308 | |
| 309 | - $this->day_of = new DayOf( $this->date_time, $this->calendar_type ); |
|
| 309 | + $this->day_of = new DayOf($this->date_time, $this->calendar_type); |
|
| 310 | 310 | |
| 311 | 311 | return $this->day_of; |
| 312 | 312 | |
@@ -317,13 +317,13 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public function events() { |
| 319 | 319 | |
| 320 | - if ( Datium::$call_type == 'between' ) { |
|
| 320 | + if (Datium::$call_type == 'between') { |
|
| 321 | 321 | |
| 322 | - $this->events = new Events( Datium::$date_start, Datium::$date_end ); |
|
| 322 | + $this->events = new Events(Datium::$date_start, Datium::$date_end); |
|
| 323 | 323 | |
| 324 | 324 | } else { |
| 325 | 325 | |
| 326 | - $this->events = new Events( $this->date_time ); |
|
| 326 | + $this->events = new Events($this->date_time); |
|
| 327 | 327 | |
| 328 | 328 | } |
| 329 | 329 | |
@@ -340,19 +340,19 @@ discard block |
||
| 340 | 340 | * |
| 341 | 341 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
| 342 | 342 | */ |
| 343 | - public function object(){ |
|
| 343 | + public function object() { |
|
| 344 | 344 | |
| 345 | 345 | return $this->date_time; |
| 346 | 346 | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | - public function lang( $language = 'fa' ){ |
|
| 349 | + public function lang($language = 'fa') { |
|
| 350 | 350 | |
| 351 | 351 | $this->language = $language; |
| 352 | 352 | |
| 353 | 353 | $this->result = new Lang(); |
| 354 | 354 | |
| 355 | - $this->result->setConfig( $this->language ); |
|
| 355 | + $this->result->setConfig($this->language); |
|
| 356 | 356 | |
| 357 | 357 | $this->toConfig = $this->result->getConfig(); |
| 358 | 358 | |
@@ -366,40 +366,40 @@ discard block |
||
| 366 | 366 | * @param $calendar string |
| 367 | 367 | * @param $format string |
| 368 | 368 | */ |
| 369 | - public function get( $format = 'Y-m-d H:i:s' ) { |
|
| 369 | + public function get($format = 'Y-m-d H:i:s') { |
|
| 370 | 370 | |
| 371 | 371 | // $this->translate_from_file = include( 'Lang/en/general.php' ); |
| 372 | 372 | // |
| 373 | 373 | // $this->translate_to_file = include( 'Lang/' . $this->language . '/general.php' ); |
| 374 | 374 | |
| 375 | - if ( is_null( $this->fromConfig ) ) { |
|
| 375 | + if (is_null($this->fromConfig)) { |
|
| 376 | 376 | |
| 377 | - $this->fromConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_from ) . '.php' ); |
|
| 377 | + $this->fromConfig = include('CalendarSettings/'.ucfirst($this->translate_from).'.php'); |
|
| 378 | 378 | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | |
| 382 | - if ( is_null( $this->toConfig ) ) { |
|
| 382 | + if (is_null($this->toConfig)) { |
|
| 383 | 383 | |
| 384 | - $this->toConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_to ) . '.php' ); |
|
| 384 | + $this->toConfig = include('CalendarSettings/'.ucfirst($this->translate_to).'.php'); |
|
| 385 | 385 | |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - $string_date = $this->date_time->format( $format ); |
|
| 388 | + $string_date = $this->date_time->format($format); |
|
| 389 | 389 | |
| 390 | - if ( $this->translate_to != 'gregorian' ) { |
|
| 390 | + if ($this->translate_to != 'gregorian') { |
|
| 391 | 391 | |
| 392 | - $string_date = str_replace( $this->fromConfig[ 'month' ], $this->toConfig[ 'month' ], $string_date ); |
|
| 392 | + $string_date = str_replace($this->fromConfig['month'], $this->toConfig['month'], $string_date); |
|
| 393 | 393 | |
| 394 | - $string_date = str_replace( $this->fromConfig[ 'days_of_week' ], $this->toConfig[ 'days_of_week' ][ $this->gregorian_DayofWeek ], $string_date ); |
|
| 394 | + $string_date = str_replace($this->fromConfig['days_of_week'], $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], $string_date); |
|
| 395 | 395 | |
| 396 | - $string_date = str_replace( $this->fromConfig[ 'numbers' ], $this->toConfig[ 'numbers' ], $string_date ); |
|
| 396 | + $string_date = str_replace($this->fromConfig['numbers'], $this->toConfig['numbers'], $string_date); |
|
| 397 | 397 | |
| 398 | - $string_date = str_replace( $this->fromConfig[ 'am_time' ], $this->toConfig[ 'am_time' ], $string_date ); |
|
| 398 | + $string_date = str_replace($this->fromConfig['am_time'], $this->toConfig['am_time'], $string_date); |
|
| 399 | 399 | |
| 400 | - $string_date = str_replace( $this->fromConfig[ 'pm_time' ], $this->toConfig[ 'pm_time' ], $string_date ); |
|
| 400 | + $string_date = str_replace($this->fromConfig['pm_time'], $this->toConfig['pm_time'], $string_date); |
|
| 401 | 401 | |
| 402 | - $string_date = str_replace( $this->fromConfig[ 'end_of_days' ], $this->toConfig[ 'end_of_days' ], $string_date ); |
|
| 402 | + $string_date = str_replace($this->fromConfig['end_of_days'], $this->toConfig['end_of_days'], $string_date); |
|
| 403 | 403 | |
| 404 | 404 | } |
| 405 | 405 | |
@@ -125,4 +125,4 @@ |
||
| 125 | 125 | */ |
| 126 | 126 | 'weekend' => array( 'friday' ) |
| 127 | 127 | |
| 128 | - ); |
|
| 128 | + ); |
|
@@ -35,9 +35,9 @@ |
||
| 35 | 35 | 'default_calendar' => 'gregorian', |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - 'date_interval' => array( 'D', 'M', 'Y', 'H', 'm', 'S' ), |
|
| 38 | + 'date_interval' => array('D', 'M', 'Y', 'H', 'm', 'S'), |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - 'date_simple' => array( 'day', ' month', ' year', ' hour', ' minute', ' second' ), |
|
| 41 | + 'date_simple' => array('day', ' month', ' year', ' hour', ' minute', ' second'), |
|
| 42 | 42 | |
| 43 | 43 | ); |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected $geregorian_DayofWeek; |
| 21 | 21 | |
| 22 | - public function __construct( $date_time, $calendar_type = 'gregorian' ) { |
|
| 22 | + public function __construct($date_time, $calendar_type = 'gregorian') { |
|
| 23 | 23 | |
| 24 | - $this->config = include( 'Config.php' ); |
|
| 24 | + $this->config = include('Config.php'); |
|
| 25 | 25 | |
| 26 | 26 | $this->date_time = $date_time; |
| 27 | 27 | |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function year() { |
| 40 | 40 | |
| 41 | - $this->config = include( 'CalendarSettings/' . ucfirst( $this->calendar_type ) . '.php' ); |
|
| 41 | + $this->config = include('CalendarSettings/'.ucfirst($this->calendar_type).'.php'); |
|
| 42 | 42 | |
| 43 | - return $this->config[ 'day_of_year' ]( $this->date_time ); |
|
| 43 | + return $this->config['day_of_year']($this->date_time); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function week() { |
| 54 | 54 | |
| 55 | - $this->config = include( 'CalendarSettings/' . ucfirst( $this->calendar_type ) . '.php' ); |
|
| 55 | + $this->config = include('CalendarSettings/'.ucfirst($this->calendar_type).'.php'); |
|
| 56 | 56 | |
| 57 | - return $this->config[ 'day_of_week' ]( $this->date_time ); |
|
| 57 | + return $this->config['day_of_week']($this->date_time); |
|
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
@@ -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 | |
@@ -2,15 +2,15 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use Datium\Datium as Datium; |
| 4 | 4 | |
| 5 | - return array ( |
|
| 5 | + return array( |
|
| 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 | 9 | 'am_time' => 'AM', |
| 10 | 10 | |
| 11 | 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 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | *\_________________________________________________________/ |
| 24 | 24 | */ |
| 25 | - 'convert_to' => function( $date_time ) { |
|
| 25 | + 'convert_to' => function($date_time) { |
|
| 26 | 26 | |
| 27 | 27 | return null; |
| 28 | 28 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | *\_________________________________________________________/ |
| 38 | 38 | */ |
| 39 | - 'convert_from' => function( $date_time ) { |
|
| 39 | + 'convert_from' => function($date_time) { |
|
| 40 | 40 | |
| 41 | 41 | return null; |
| 42 | 42 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | *\_________________________________________________________/ |
| 99 | 99 | */ |
| 100 | - 'days_of_week' => array ( |
|
| 100 | + 'days_of_week' => array( |
|
| 101 | 101 | |
| 102 | 102 | 'Monday', |
| 103 | 103 | 'Tuesday', |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | ), |
| 110 | 110 | |
| 111 | 111 | |
| 112 | - 'month_days_number' => array( 1 => 31, |
|
| 112 | + 'month_days_number' => array(1 => 31, |
|
| 113 | 113 | 2 => 28, |
| 114 | 114 | 3 => 31, |
| 115 | 115 | 4 => 30, |
@@ -120,24 +120,24 @@ discard block |
||
| 120 | 120 | 9 => 30, |
| 121 | 121 | 10 => 31, |
| 122 | 122 | 11 => 30, |
| 123 | - 12 => 30 ), |
|
| 123 | + 12 => 30), |
|
| 124 | 124 | |
| 125 | 125 | |
| 126 | - 'day_of_year' => function( $date_time ) { |
|
| 126 | + 'day_of_year' => function($date_time) { |
|
| 127 | 127 | |
| 128 | 128 | $result = null; |
| 129 | 129 | |
| 130 | 130 | $_month = null; |
| 131 | 131 | |
| 132 | - $config = include( 'Gregorian.php' ); |
|
| 132 | + $config = include('Gregorian.php'); |
|
| 133 | 133 | |
| 134 | 134 | $month = $date_time->format('n'); |
| 135 | 135 | |
| 136 | 136 | $day = $date_time->format('d'); |
| 137 | 137 | |
| 138 | - foreach( $config['month_days_number'] as $_month => $value ) { |
|
| 138 | + foreach ($config['month_days_number'] as $_month => $value) { |
|
| 139 | 139 | |
| 140 | - if ( $_month < $month ) $result += $value; |
|
| 140 | + if ($_month < $month) $result += $value; |
|
| 141 | 141 | |
| 142 | 142 | } |
| 143 | 143 | |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | }, |
| 149 | 149 | |
| 150 | - 'day_of_week' => function( $date_time ) { |
|
| 150 | + 'day_of_week' => function($date_time) { |
|
| 151 | 151 | |
| 152 | - $config = include( 'Gregorian.php' ); |
|
| 152 | + $config = include('Gregorian.php'); |
|
| 153 | 153 | |
| 154 | 154 | $day = $date_time->format('l'); |
| 155 | 155 | |
| 156 | 156 | foreach ($config['days_of_week'] as $key => $value) { |
| 157 | 157 | |
| 158 | - if ( $value == $day ) return $key += 1; |
|
| 158 | + if ($value == $day) return $key += 1; |
|
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
@@ -179,6 +179,6 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | *\_________________________________________________________/ |
| 181 | 181 | */ |
| 182 | - 'weekend' => array( 'saturday', 'sunday' ), |
|
| 182 | + 'weekend' => array('saturday', 'sunday'), |
|
| 183 | 183 | |
| 184 | 184 | ); |
@@ -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 array ( |
|
| 5 | + return array ( |
|
| 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,13 +22,13 @@ 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 |
| 33 | 33 | ************************************************************ |
| 34 | 34 | * |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | *\_________________________________________________________/ |
| 38 | 38 | */ |
| 39 | - 'convert_from' => function( $date_time ) { |
|
| 39 | + 'convert_from' => function( $date_time ) { |
|
| 40 | 40 | |
| 41 | - return null; |
|
| 41 | + return null; |
|
| 42 | 42 | |
| 43 | - }, |
|
| 43 | + }, |
|
| 44 | 44 | |
| 45 | - /************************************************************ |
|
| 45 | + /************************************************************ |
|
| 46 | 46 | * Shorthand for jalali calendar |
| 47 | 47 | ************************************************************ |
| 48 | 48 | * |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | *\_________________________________________________________/ |
| 52 | 52 | */ |
| 53 | - 'shorthand' => 'gr', |
|
| 53 | + 'shorthand' => 'gr', |
|
| 54 | 54 | |
| 55 | - /************************************************************ |
|
| 55 | + /************************************************************ |
|
| 56 | 56 | * Month's name |
| 57 | 57 | ************************************************************ |
| 58 | 58 | * |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | 'December' |
| 88 | 88 | |
| 89 | - ), |
|
| 89 | + ), |
|
| 90 | 90 | |
| 91 | - /************************************************************ |
|
| 91 | + /************************************************************ |
|
| 92 | 92 | * Days of Week |
| 93 | 93 | ************************************************************ |
| 94 | 94 | * |
@@ -97,55 +97,55 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | *\_________________________________________________________/ |
| 99 | 99 | */ |
| 100 | - 'days_of_week' => array ( |
|
| 100 | + 'days_of_week' => array ( |
|
| 101 | 101 | |
| 102 | - 'Monday', |
|
| 103 | - 'Tuesday', |
|
| 104 | - 'Wednesday', |
|
| 105 | - 'Thursday', |
|
| 106 | - 'Friday', |
|
| 107 | - 'Saturday', |
|
| 108 | - 'Sunday', |
|
| 109 | - ), |
|
| 102 | + 'Monday', |
|
| 103 | + 'Tuesday', |
|
| 104 | + 'Wednesday', |
|
| 105 | + 'Thursday', |
|
| 106 | + 'Friday', |
|
| 107 | + 'Saturday', |
|
| 108 | + 'Sunday', |
|
| 109 | + ), |
|
| 110 | 110 | |
| 111 | 111 | |
| 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 ), |
|
| 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 ), |
|
| 124 | 124 | |
| 125 | 125 | |
| 126 | - 'day_of_year' => function( $date_time ) { |
|
| 126 | + 'day_of_year' => function( $date_time ) { |
|
| 127 | 127 | |
| 128 | - $result = null; |
|
| 128 | + $result = null; |
|
| 129 | 129 | |
| 130 | - $_month = null; |
|
| 130 | + $_month = null; |
|
| 131 | 131 | |
| 132 | - $config = include( 'Gregorian.php' ); |
|
| 132 | + $config = include( 'Gregorian.php' ); |
|
| 133 | 133 | |
| 134 | - $month = $date_time->format('n'); |
|
| 134 | + $month = $date_time->format('n'); |
|
| 135 | 135 | |
| 136 | - $day = $date_time->format('d'); |
|
| 136 | + $day = $date_time->format('d'); |
|
| 137 | 137 | |
| 138 | - foreach( $config['month_days_number'] as $_month => $value ) { |
|
| 138 | + foreach( $config['month_days_number'] as $_month => $value ) { |
|
| 139 | 139 | |
| 140 | - if ( $_month < $month ) $result += $value; |
|
| 140 | + if ( $_month < $month ) $result += $value; |
|
| 141 | 141 | |
| 142 | - } |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - $result += $day; |
|
| 144 | + $result += $day; |
|
| 145 | 145 | |
| 146 | - return $result; |
|
| 146 | + return $result; |
|
| 147 | 147 | |
| 148 | - }, |
|
| 148 | + }, |
|
| 149 | 149 | |
| 150 | 150 | 'day_of_week' => function( $date_time ) { |
| 151 | 151 | |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - }, |
|
| 162 | + }, |
|
| 163 | 163 | |
| 164 | - /************************************************************ |
|
| 164 | + /************************************************************ |
|
| 165 | 165 | * Leap year |
| 166 | 166 | ************************************************************ |
| 167 | 167 | * |
@@ -169,9 +169,9 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | *\_________________________________________________________/ |
| 171 | 171 | */ |
| 172 | - 'leap_year' => null, |
|
| 172 | + 'leap_year' => null, |
|
| 173 | 173 | |
| 174 | - /************************************************************ |
|
| 174 | + /************************************************************ |
|
| 175 | 175 | * Weekend |
| 176 | 176 | ************************************************************ |
| 177 | 177 | * |
@@ -179,6 +179,6 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | *\_________________________________________________________/ |
| 181 | 181 | */ |
| 182 | - 'weekend' => array( 'saturday', 'sunday' ), |
|
| 182 | + 'weekend' => array( 'saturday', 'sunday' ), |
|
| 183 | 183 | |
| 184 | 184 | ); |
@@ -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( |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | 4 | |
| 5 | - 'events' => array( 'eid fitr' => 'عيد الفطر', |
|
| 5 | + 'events' => array('eid fitr' => 'عيد الفطر', |
|
| 6 | 6 | |
| 7 | 7 | ), |
| 8 | 8 | |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | 'pm_time' => '', |
| 39 | 39 | |
| 40 | - 'end_of_days' => array( "" ), |
|
| 40 | + 'end_of_days' => array(""), |
|
| 41 | 41 | |
| 42 | - 'numbers' => array( '۰', '۱', '۲', '۳', '٤', '٥', '٦', '۷', '۸', '۹'), |
|
| 42 | + 'numbers' => array('۰', '۱', '۲', '۳', '٤', '٥', '٦', '۷', '۸', '۹'), |
|
| 43 | 43 | |
| 44 | 44 | ); |
| 45 | 45 | |
@@ -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 | |
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | use OpenCafe\Datium as Datium; |
| 4 | 4 | use OpenCafe\Tools\Leap as Leap; |
| 5 | 5 | |
| 6 | - return array ( |
|
| 6 | + return array ( |
|
| 7 | 7 | |
| 8 | - /************************************************************ |
|
| 8 | + /************************************************************ |
|
| 9 | 9 | * Convert to |
| 10 | 10 | ************************************************************ |
| 11 | 11 | * |
@@ -13,85 +13,85 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | *\_________________________________________________________/ |
| 15 | 15 | */ |
| 16 | - 'convert_to' => function( $date_time ) { |
|
| 16 | + 'convert_to' => function( $date_time ) { |
|
| 17 | 17 | |
| 18 | - $config = include( 'Jalali.php' ); |
|
| 18 | + $config = include( 'Jalali.php' ); |
|
| 19 | 19 | |
| 20 | - $date_time = Datium::create( $date_time )->to( 'jalali' )->object(); |
|
| 20 | + $date_time = Datium::create( $date_time )->to( 'jalali' )->object(); |
|
| 21 | 21 | |
| 22 | - $year = $date_time->format('Y'); |
|
| 22 | + $year = $date_time->format('Y'); |
|
| 23 | 23 | |
| 24 | - $month = $date_time->format('n'); |
|
| 24 | + $month = $date_time->format('n'); |
|
| 25 | 25 | |
| 26 | - $day = $date_time->format('d'); |
|
| 26 | + $day = $date_time->format('d'); |
|
| 27 | 27 | |
| 28 | - $temp_day = 0 ; |
|
| 28 | + $temp_day = 0 ; |
|
| 29 | 29 | |
| 30 | - for ( $i = 1 ; $i < $month ; $i++ ) { |
|
| 30 | + for ( $i = 1 ; $i < $month ; $i++ ) { |
|
| 31 | 31 | |
| 32 | - $temp_day += $config[ 'month_days_number' ][ $i ]; |
|
| 32 | + $temp_day += $config[ 'month_days_number' ][ $i ]; |
|
| 33 | 33 | |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | $temp_day += $day; |
| 37 | 37 | |
| 38 | 38 | $leap = new Leap( $year ); |
| 39 | 39 | |
| 40 | - if( $leap->get() && $month > 11 ) $temp_day++; |
|
| 40 | + if( $leap->get() && $month > 11 ) $temp_day++; |
|
| 41 | 41 | |
| 42 | - $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
| 42 | + $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
| 43 | 43 | |
| 44 | - $_year = explode( '.', $_year ); |
|
| 44 | + $_year = explode( '.', $_year ); |
|
| 45 | 45 | |
| 46 | - $year = $_year[0]; |
|
| 46 | + $year = $_year[0]; |
|
| 47 | 47 | |
| 48 | - $_month = $_year[1]; |
|
| 48 | + $_month = $_year[1]; |
|
| 49 | 49 | |
| 50 | 50 | $var_temp = '0.0'; |
| 51 | 51 | |
| 52 | - for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
|
| 52 | + for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
|
| 53 | 53 | |
| 54 | - $var_temp .= '0'; |
|
| 54 | + $var_temp .= '0'; |
|
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $var_temp .= '1'; |
| 59 | 59 | |
| 60 | - $_month = $_month * $var_temp ; |
|
| 60 | + $_month = $_month * $var_temp ; |
|
| 61 | 61 | |
| 62 | - $_month = ( $_month * 12 ) + 1; |
|
| 62 | + $_month = ( $_month * 12 ) + 1; |
|
| 63 | 63 | |
| 64 | - $_month = explode( '.', $_month ); |
|
| 64 | + $_month = explode( '.', $_month ); |
|
| 65 | 65 | |
| 66 | - $month = $_month[0]; |
|
| 66 | + $month = $_month[0]; |
|
| 67 | 67 | |
| 68 | - $_day = $_month[1]; |
|
| 68 | + $_day = $_month[1]; |
|
| 69 | 69 | |
| 70 | - $var_temp = '0.0'; |
|
| 70 | + $var_temp = '0.0'; |
|
| 71 | 71 | |
| 72 | - for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
|
| 72 | + for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
|
| 73 | 73 | |
| 74 | 74 | $var_temp .= '0' ; |
| 75 | 75 | |
| 76 | - } |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - $var_temp .= '1'; |
|
| 78 | + $var_temp .= '1'; |
|
| 79 | 79 | |
| 80 | - $_day = $_day * $var_temp; |
|
| 80 | + $_day = $_day * $var_temp; |
|
| 81 | 81 | |
| 82 | - $_day = ( $_day * 29.530 ); |
|
| 82 | + $_day = ( $_day * 29.530 ); |
|
| 83 | 83 | |
| 84 | - $_day = explode( '.', $_day ); |
|
| 84 | + $_day = explode( '.', $_day ); |
|
| 85 | 85 | |
| 86 | - $day = $_day[0]; |
|
| 86 | + $day = $_day[0]; |
|
| 87 | 87 | |
| 88 | 88 | $date_time->setDate( $year, $month, $day ); |
| 89 | 89 | |
| 90 | 90 | return $date_time; |
| 91 | 91 | |
| 92 | - }, |
|
| 92 | + }, |
|
| 93 | 93 | |
| 94 | - /************************************************************ |
|
| 94 | + /************************************************************ |
|
| 95 | 95 | * Convert From |
| 96 | 96 | ************************************************************ |
| 97 | 97 | * |
@@ -99,62 +99,62 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | *\_________________________________________________________/ |
| 101 | 101 | */ |
| 102 | - 'convert_from' => function( $date_time ) { |
|
| 102 | + 'convert_from' => function( $date_time ) { |
|
| 103 | 103 | |
| 104 | - $config = include('Hijri.php'); |
|
| 104 | + $config = include('Hijri.php'); |
|
| 105 | 105 | |
| 106 | - $year = $date_time->format('Y'); |
|
| 106 | + $year = $date_time->format('Y'); |
|
| 107 | 107 | |
| 108 | - $month = $date_time->format('m'); |
|
| 108 | + $month = $date_time->format('m'); |
|
| 109 | 109 | |
| 110 | - $day = $date_time->format('d'); |
|
| 110 | + $day = $date_time->format('d'); |
|
| 111 | 111 | |
| 112 | - $days_of_year = 0; |
|
| 112 | + $days_of_year = 0; |
|
| 113 | 113 | |
| 114 | - foreach ( $config['month_days_number'] as $month => $value ) { |
|
| 114 | + foreach ( $config['month_days_number'] as $month => $value ) { |
|
| 115 | 115 | |
| 116 | - if( $month > $month ) $days_of_year += $value; |
|
| 116 | + if( $month > $month ) $days_of_year += $value; |
|
| 117 | 117 | |
| 118 | - } |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - $days_of_year += $day; |
|
| 120 | + $days_of_year += $day; |
|
| 121 | 121 | |
| 122 | - $days_of_leap_years = intval( ( ( $year - 1 ) / 3 ) ); |
|
| 122 | + $days_of_leap_years = intval( ( ( $year - 1 ) / 3 ) ); |
|
| 123 | 123 | |
| 124 | - $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
| 124 | + $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
| 125 | 125 | |
| 126 | - $days_of_gregorain_years = $days_of_ghamari_years + 227078; |
|
| 126 | + $days_of_gregorain_years = $days_of_ghamari_years + 227078; |
|
| 127 | 127 | |
| 128 | - $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 578 ) / 4 ) ); |
|
| 128 | + $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 578 ) / 4 ) ); |
|
| 129 | 129 | |
| 130 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
| 130 | + $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
| 131 | 131 | |
| 132 | - $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1; |
|
| 132 | + $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1; |
|
| 133 | 133 | |
| 134 | - $config = include('Gregorian.php'); |
|
| 134 | + $config = include('Gregorian.php'); |
|
| 135 | 135 | |
| 136 | - foreach ($config [ 'month_days_number' ] as $month => $value) { |
|
| 136 | + foreach ($config [ 'month_days_number' ] as $month => $value) { |
|
| 137 | 137 | |
| 138 | - if ( $gregorian_month < $value ) { |
|
| 138 | + if ( $gregorian_month < $value ) { |
|
| 139 | 139 | |
| 140 | - break; |
|
| 141 | - } |
|
| 140 | + break; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - $gregorian_month -= $value; |
|
| 144 | - } |
|
| 143 | + $gregorian_month -= $value; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - $gregorian_day = $gregorian_month; |
|
| 146 | + $gregorian_day = $gregorian_month; |
|
| 147 | 147 | |
| 148 | - $gregorian_month = $month; |
|
| 148 | + $gregorian_month = $month; |
|
| 149 | 149 | |
| 150 | - $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
|
| 150 | + $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
|
| 151 | 151 | |
| 152 | 152 | return $date_time; |
| 153 | 153 | |
| 154 | 154 | |
| 155 | - }, |
|
| 155 | + }, |
|
| 156 | 156 | |
| 157 | - /************************************************************ |
|
| 157 | + /************************************************************ |
|
| 158 | 158 | * Shorthand for jalali calendar |
| 159 | 159 | ************************************************************ |
| 160 | 160 | * |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | *\_________________________________________________________/ |
| 164 | 164 | */ |
| 165 | - 'shorthand' => 'sh', |
|
| 165 | + 'shorthand' => 'sh', |
|
| 166 | 166 | |
| 167 | - /************************************************************ |
|
| 167 | + /************************************************************ |
|
| 168 | 168 | * Month's name |
| 169 | 169 | ************************************************************ |
| 170 | 170 | * |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | *\_________________________________________________________/ |
| 174 | 174 | */ |
| 175 | - 'month' => array ( |
|
| 175 | + 'month' => array ( |
|
| 176 | 176 | |
| 177 | 177 | 'Muharram', |
| 178 | 178 | |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | 'Dhu al_Hijjah' |
| 200 | 200 | |
| 201 | - ), |
|
| 201 | + ), |
|
| 202 | 202 | |
| 203 | - /************************************************************ |
|
| 203 | + /************************************************************ |
|
| 204 | 204 | * Days of Week |
| 205 | 205 | ************************************************************ |
| 206 | 206 | * |
@@ -209,40 +209,40 @@ discard block |
||
| 209 | 209 | * |
| 210 | 210 | *\_________________________________________________________/ |
| 211 | 211 | */ |
| 212 | - 'days_of_week' => array ( |
|
| 213 | - 'al-Aḥad', |
|
| 214 | - 'al-Ithnayn', |
|
| 215 | - 'ath-Thulatha\'', |
|
| 216 | - 'al-Arbi\'a', |
|
| 217 | - 'al-Khamees', |
|
| 218 | - 'al-Jumu\'ah', |
|
| 219 | - 'as-Sabt', |
|
| 212 | + 'days_of_week' => array ( |
|
| 213 | + 'al-Aḥad', |
|
| 214 | + 'al-Ithnayn', |
|
| 215 | + 'ath-Thulatha\'', |
|
| 216 | + 'al-Arbi\'a', |
|
| 217 | + 'al-Khamees', |
|
| 218 | + 'al-Jumu\'ah', |
|
| 219 | + 'as-Sabt', |
|
| 220 | 220 | |
| 221 | - ), |
|
| 221 | + ), |
|
| 222 | 222 | |
| 223 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 223 | + 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 224 | 224 | |
| 225 | - 'am_time' => 'AM', |
|
| 225 | + 'am_time' => 'AM', |
|
| 226 | 226 | |
| 227 | - 'pm_time' => 'PM', |
|
| 227 | + 'pm_time' => 'PM', |
|
| 228 | 228 | |
| 229 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 229 | + 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | |
| 233 | 233 | |
| 234 | - 'month_days_number' => array( 1 => 30, |
|
| 235 | - 2 => 29, |
|
| 236 | - 3 => 30, |
|
| 237 | - 4 => 30, |
|
| 238 | - 5 => 29, |
|
| 239 | - 6 => 29, |
|
| 240 | - 7 => 30, |
|
| 241 | - 8 => 29, |
|
| 242 | - 9 => 30, |
|
| 243 | - 10 => 29, |
|
| 244 | - 11 => 30, |
|
| 245 | - 12 => 30 ), |
|
| 234 | + 'month_days_number' => array( 1 => 30, |
|
| 235 | + 2 => 29, |
|
| 236 | + 3 => 30, |
|
| 237 | + 4 => 30, |
|
| 238 | + 5 => 29, |
|
| 239 | + 6 => 29, |
|
| 240 | + 7 => 30, |
|
| 241 | + 8 => 29, |
|
| 242 | + 9 => 30, |
|
| 243 | + 10 => 29, |
|
| 244 | + 11 => 30, |
|
| 245 | + 12 => 30 ), |
|
| 246 | 246 | /************************************************************ |
| 247 | 247 | * Day of year |
| 248 | 248 | ************************************************************ |
@@ -251,33 +251,33 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | *\_________________________________________________________/ |
| 253 | 253 | */ |
| 254 | - 'day_of_year' => function( $date_time ) { |
|
| 254 | + 'day_of_year' => function( $date_time ) { |
|
| 255 | 255 | |
| 256 | - $result = null; |
|
| 256 | + $result = null; |
|
| 257 | 257 | |
| 258 | - $config = include( 'Hijri.php' ); |
|
| 258 | + $config = include( 'Hijri.php' ); |
|
| 259 | 259 | |
| 260 | - $month = $date_time->format('n'); |
|
| 260 | + $month = $date_time->format('n'); |
|
| 261 | 261 | |
| 262 | - $day = $date_time->format('d'); |
|
| 262 | + $day = $date_time->format('d'); |
|
| 263 | 263 | |
| 264 | - foreach( $config['month_days_number'] as $_month => $value ) { |
|
| 264 | + foreach( $config['month_days_number'] as $_month => $value ) { |
|
| 265 | 265 | |
| 266 | - if ( $_month < $month ) { |
|
| 266 | + if ( $_month < $month ) { |
|
| 267 | 267 | |
| 268 | - $result += $value; |
|
| 268 | + $result += $value; |
|
| 269 | 269 | |
| 270 | - } |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - } |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - $result += $day; |
|
| 274 | + $result += $day; |
|
| 275 | 275 | |
| 276 | - return $result; |
|
| 276 | + return $result; |
|
| 277 | 277 | |
| 278 | - }, |
|
| 278 | + }, |
|
| 279 | 279 | |
| 280 | - /************************************************************ |
|
| 280 | + /************************************************************ |
|
| 281 | 281 | * Day of week |
| 282 | 282 | ************************************************************ |
| 283 | 283 | * |
@@ -285,29 +285,29 @@ discard block |
||
| 285 | 285 | * example : al-Aḥad = result is 1 |
| 286 | 286 | *\_________________________________________________________/ |
| 287 | 287 | */ |
| 288 | - 'day_of_week' => function( $date_time ) { |
|
| 288 | + 'day_of_week' => function( $date_time ) { |
|
| 289 | 289 | |
| 290 | - $configGhamari = include( 'Hijri.php' ); |
|
| 290 | + $configGhamari = include( 'Hijri.php' ); |
|
| 291 | 291 | |
| 292 | - $configGregorian = include( 'Gregorian.php' ); |
|
| 292 | + $configGregorian = include( 'Gregorian.php' ); |
|
| 293 | 293 | |
| 294 | - $day = $date_time->format('l'); |
|
| 294 | + $day = $date_time->format('l'); |
|
| 295 | 295 | |
| 296 | - $day = str_replace( $configGregorian['days_of_week'], $configGhamari['days_of_week'], $day); |
|
| 296 | + $day = str_replace( $configGregorian['days_of_week'], $configGhamari['days_of_week'], $day); |
|
| 297 | 297 | |
| 298 | - foreach ( $configGhamari['days_of_week'] as $key => $value ) { |
|
| 298 | + foreach ( $configGhamari['days_of_week'] as $key => $value ) { |
|
| 299 | 299 | |
| 300 | - if( $value == $day ) { |
|
| 300 | + if( $value == $day ) { |
|
| 301 | 301 | |
| 302 | - return $key += 1; |
|
| 302 | + return $key += 1; |
|
| 303 | 303 | |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | - } |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | - }, |
|
| 308 | + }, |
|
| 309 | 309 | |
| 310 | - /************************************************************ |
|
| 310 | + /************************************************************ |
|
| 311 | 311 | * Leap year |
| 312 | 312 | ************************************************************ |
| 313 | 313 | * |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | *\_________________________________________________________/ |
| 317 | 317 | */ |
| 318 | - 'leap_year' => null, |
|
| 318 | + 'leap_year' => null, |
|
| 319 | 319 | |
| 320 | - /************************************************************ |
|
| 320 | + /************************************************************ |
|
| 321 | 321 | * Weekend |
| 322 | 322 | ************************************************************ |
| 323 | 323 | * |
@@ -325,6 +325,6 @@ discard block |
||
| 325 | 325 | * |
| 326 | 326 | *\_________________________________________________________/ |
| 327 | 327 | */ |
| 328 | - 'weekend' => array( 'friday', 'saturday' ), |
|
| 328 | + 'weekend' => array( 'friday', 'saturday' ), |
|
| 329 | 329 | |
| 330 | 330 | ); |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use OpenCafe\Datium as Datium; |
| 4 | 4 | use OpenCafe\Tools\Leap as Leap; |
| 5 | 5 | |
| 6 | - return array ( |
|
| 6 | + return array( |
|
| 7 | 7 | |
| 8 | 8 | /************************************************************ |
| 9 | 9 | * Convert to |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | *\_________________________________________________________/ |
| 15 | 15 | */ |
| 16 | - 'convert_to' => function( $date_time ) { |
|
| 16 | + 'convert_to' => function($date_time) { |
|
| 17 | 17 | |
| 18 | - $config = include( 'Jalali.php' ); |
|
| 18 | + $config = include('Jalali.php'); |
|
| 19 | 19 | |
| 20 | - $date_time = Datium::create( $date_time )->to( 'jalali' )->object(); |
|
| 20 | + $date_time = Datium::create($date_time)->to('jalali')->object(); |
|
| 21 | 21 | |
| 22 | 22 | $year = $date_time->format('Y'); |
| 23 | 23 | |
@@ -25,23 +25,23 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $day = $date_time->format('d'); |
| 27 | 27 | |
| 28 | - $temp_day = 0 ; |
|
| 28 | + $temp_day = 0; |
|
| 29 | 29 | |
| 30 | - for ( $i = 1 ; $i < $month ; $i++ ) { |
|
| 30 | + for ($i = 1; $i < $month; $i++) { |
|
| 31 | 31 | |
| 32 | - $temp_day += $config[ 'month_days_number' ][ $i ]; |
|
| 32 | + $temp_day += $config['month_days_number'][$i]; |
|
| 33 | 33 | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $temp_day += $day; |
| 37 | 37 | |
| 38 | - $leap = new Leap( $year ); |
|
| 38 | + $leap = new Leap($year); |
|
| 39 | 39 | |
| 40 | - if( $leap->get() && $month > 11 ) $temp_day++; |
|
| 40 | + if ($leap->get() && $month > 11) $temp_day++; |
|
| 41 | 41 | |
| 42 | - $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
| 42 | + $_year = ((((($year - 1) * 365.2422) + $temp_day) - 119) / 354.3670) + 1; |
|
| 43 | 43 | |
| 44 | - $_year = explode( '.', $_year ); |
|
| 44 | + $_year = explode('.', $_year); |
|
| 45 | 45 | |
| 46 | 46 | $year = $_year[0]; |
| 47 | 47 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $var_temp = '0.0'; |
| 51 | 51 | |
| 52 | - for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
|
| 52 | + for ($i = strlen($_month); $i > 2; $i--) { |
|
| 53 | 53 | |
| 54 | 54 | $var_temp .= '0'; |
| 55 | 55 | |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $var_temp .= '1'; |
| 59 | 59 | |
| 60 | - $_month = $_month * $var_temp ; |
|
| 60 | + $_month = $_month * $var_temp; |
|
| 61 | 61 | |
| 62 | - $_month = ( $_month * 12 ) + 1; |
|
| 62 | + $_month = ($_month * 12) + 1; |
|
| 63 | 63 | |
| 64 | - $_month = explode( '.', $_month ); |
|
| 64 | + $_month = explode('.', $_month); |
|
| 65 | 65 | |
| 66 | 66 | $month = $_month[0]; |
| 67 | 67 | |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | $var_temp = '0.0'; |
| 71 | 71 | |
| 72 | - for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
|
| 72 | + for ($i = strlen($_day); $i > 2; $i--) { |
|
| 73 | 73 | |
| 74 | - $var_temp .= '0' ; |
|
| 74 | + $var_temp .= '0'; |
|
| 75 | 75 | |
| 76 | 76 | } |
| 77 | 77 | |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $_day = $_day * $var_temp; |
| 81 | 81 | |
| 82 | - $_day = ( $_day * 29.530 ); |
|
| 82 | + $_day = ($_day * 29.530); |
|
| 83 | 83 | |
| 84 | - $_day = explode( '.', $_day ); |
|
| 84 | + $_day = explode('.', $_day); |
|
| 85 | 85 | |
| 86 | 86 | $day = $_day[0]; |
| 87 | 87 | |
| 88 | - $date_time->setDate( $year, $month, $day ); |
|
| 88 | + $date_time->setDate($year, $month, $day); |
|
| 89 | 89 | |
| 90 | 90 | return $date_time; |
| 91 | 91 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | *\_________________________________________________________/ |
| 101 | 101 | */ |
| 102 | - 'convert_from' => function( $date_time ) { |
|
| 102 | + 'convert_from' => function($date_time) { |
|
| 103 | 103 | |
| 104 | 104 | $config = include('Hijri.php'); |
| 105 | 105 | |
@@ -111,31 +111,31 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $days_of_year = 0; |
| 113 | 113 | |
| 114 | - foreach ( $config['month_days_number'] as $month => $value ) { |
|
| 114 | + foreach ($config['month_days_number'] as $month => $value) { |
|
| 115 | 115 | |
| 116 | - if( $month > $month ) $days_of_year += $value; |
|
| 116 | + if ($month > $month) $days_of_year += $value; |
|
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $days_of_year += $day; |
| 121 | 121 | |
| 122 | - $days_of_leap_years = intval( ( ( $year - 1 ) / 3 ) ); |
|
| 122 | + $days_of_leap_years = intval((($year - 1) / 3)); |
|
| 123 | 123 | |
| 124 | - $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
| 124 | + $days_of_ghamari_years = ((($year - 1) * 354) + $days_of_year + $days_of_leap_years); |
|
| 125 | 125 | |
| 126 | 126 | $days_of_gregorain_years = $days_of_ghamari_years + 227078; |
| 127 | 127 | |
| 128 | - $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 578 ) / 4 ) ); |
|
| 128 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 578) / 4)); |
|
| 129 | 129 | |
| 130 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
| 130 | + $gregorian_month = ($days_of_gregorain_years % 365); |
|
| 131 | 131 | |
| 132 | - $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1; |
|
| 132 | + $gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
|
| 133 | 133 | |
| 134 | 134 | $config = include('Gregorian.php'); |
| 135 | 135 | |
| 136 | - foreach ($config [ 'month_days_number' ] as $month => $value) { |
|
| 136 | + foreach ($config ['month_days_number'] as $month => $value) { |
|
| 137 | 137 | |
| 138 | - if ( $gregorian_month < $value ) { |
|
| 138 | + if ($gregorian_month < $value) { |
|
| 139 | 139 | |
| 140 | 140 | break; |
| 141 | 141 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $gregorian_month = $month; |
| 149 | 149 | |
| 150 | - $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
|
| 150 | + $date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
|
| 151 | 151 | |
| 152 | 152 | return $date_time; |
| 153 | 153 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | *\_________________________________________________________/ |
| 174 | 174 | */ |
| 175 | - 'month' => array ( |
|
| 175 | + 'month' => array( |
|
| 176 | 176 | |
| 177 | 177 | 'Muharram', |
| 178 | 178 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * |
| 210 | 210 | *\_________________________________________________________/ |
| 211 | 211 | */ |
| 212 | - 'days_of_week' => array ( |
|
| 212 | + 'days_of_week' => array( |
|
| 213 | 213 | 'al-Aḥad', |
| 214 | 214 | 'al-Ithnayn', |
| 215 | 215 | 'ath-Thulatha\'', |
@@ -220,18 +220,18 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | ), |
| 222 | 222 | |
| 223 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 223 | + 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 224 | 224 | |
| 225 | 225 | 'am_time' => 'AM', |
| 226 | 226 | |
| 227 | 227 | 'pm_time' => 'PM', |
| 228 | 228 | |
| 229 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 229 | + 'end_of_days' => array('th', 'st', 'nd', 'rd'), |
|
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | |
| 233 | 233 | |
| 234 | - 'month_days_number' => array( 1 => 30, |
|
| 234 | + 'month_days_number' => array(1 => 30, |
|
| 235 | 235 | 2 => 29, |
| 236 | 236 | 3 => 30, |
| 237 | 237 | 4 => 30, |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | 9 => 30, |
| 243 | 243 | 10 => 29, |
| 244 | 244 | 11 => 30, |
| 245 | - 12 => 30 ), |
|
| 245 | + 12 => 30), |
|
| 246 | 246 | /************************************************************ |
| 247 | 247 | * Day of year |
| 248 | 248 | ************************************************************ |
@@ -251,19 +251,19 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | *\_________________________________________________________/ |
| 253 | 253 | */ |
| 254 | - 'day_of_year' => function( $date_time ) { |
|
| 254 | + 'day_of_year' => function($date_time) { |
|
| 255 | 255 | |
| 256 | 256 | $result = null; |
| 257 | 257 | |
| 258 | - $config = include( 'Hijri.php' ); |
|
| 258 | + $config = include('Hijri.php'); |
|
| 259 | 259 | |
| 260 | 260 | $month = $date_time->format('n'); |
| 261 | 261 | |
| 262 | 262 | $day = $date_time->format('d'); |
| 263 | 263 | |
| 264 | - foreach( $config['month_days_number'] as $_month => $value ) { |
|
| 264 | + foreach ($config['month_days_number'] as $_month => $value) { |
|
| 265 | 265 | |
| 266 | - if ( $_month < $month ) { |
|
| 266 | + if ($_month < $month) { |
|
| 267 | 267 | |
| 268 | 268 | $result += $value; |
| 269 | 269 | |
@@ -285,19 +285,19 @@ discard block |
||
| 285 | 285 | * example : al-Aḥad = result is 1 |
| 286 | 286 | *\_________________________________________________________/ |
| 287 | 287 | */ |
| 288 | - 'day_of_week' => function( $date_time ) { |
|
| 288 | + 'day_of_week' => function($date_time) { |
|
| 289 | 289 | |
| 290 | - $configGhamari = include( 'Hijri.php' ); |
|
| 290 | + $configGhamari = include('Hijri.php'); |
|
| 291 | 291 | |
| 292 | - $configGregorian = include( 'Gregorian.php' ); |
|
| 292 | + $configGregorian = include('Gregorian.php'); |
|
| 293 | 293 | |
| 294 | 294 | $day = $date_time->format('l'); |
| 295 | 295 | |
| 296 | - $day = str_replace( $configGregorian['days_of_week'], $configGhamari['days_of_week'], $day); |
|
| 296 | + $day = str_replace($configGregorian['days_of_week'], $configGhamari['days_of_week'], $day); |
|
| 297 | 297 | |
| 298 | - foreach ( $configGhamari['days_of_week'] as $key => $value ) { |
|
| 298 | + foreach ($configGhamari['days_of_week'] as $key => $value) { |
|
| 299 | 299 | |
| 300 | - if( $value == $day ) { |
|
| 300 | + if ($value == $day) { |
|
| 301 | 301 | |
| 302 | 302 | return $key += 1; |
| 303 | 303 | |
@@ -325,6 +325,6 @@ discard block |
||
| 325 | 325 | * |
| 326 | 326 | *\_________________________________________________________/ |
| 327 | 327 | */ |
| 328 | - 'weekend' => array( 'friday', 'saturday' ), |
|
| 328 | + 'weekend' => array('friday', 'saturday'), |
|
| 329 | 329 | |
| 330 | 330 | ); |
@@ -40,26 +40,26 @@ |
||
| 40 | 40 | /** |
| 41 | 41 | * Fetch translated file to config attribute |
| 42 | 42 | */ |
| 43 | - self::$config = include( 'src/CalendarSettings/Jalali.php' ); |
|
| 43 | + self::$config = include( 'src/CalendarSettings/Jalali.php' ); |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Fetch translated expression to langTable attribute |
|
| 47 | - */ |
|
| 48 | - self::$langTable = include( 'lang/' . $language . '/general.php' ); |
|
| 45 | + /** |
|
| 46 | + * Fetch translated expression to langTable attribute |
|
| 47 | + */ |
|
| 48 | + self::$langTable = include( 'lang/' . $language . '/general.php' ); |
|
| 49 | 49 | |
| 50 | - foreach( self::$langTable as $key => $translate ){ |
|
| 50 | + foreach( self::$langTable as $key => $translate ){ |
|
| 51 | 51 | |
| 52 | - if ( isset( self::$config[ $key ] ) ) { |
|
| 52 | + if ( isset( self::$config[ $key ] ) ) { |
|
| 53 | 53 | |
| 54 | - if ( self::$config[ $key ] ) { |
|
| 54 | + if ( self::$config[ $key ] ) { |
|
| 55 | 55 | |
| 56 | - self::$config[ $key ] = $translate; |
|
| 56 | + self::$config[ $key ] = $translate; |
|
| 57 | 57 | |
| 58 | - } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
@@ -35,25 +35,25 @@ |
||
| 35 | 35 | * |
| 36 | 36 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
| 37 | 37 | */ |
| 38 | - public static function setConfig( $language ) { |
|
| 38 | + public static function setConfig($language) { |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Fetch translated file to config attribute |
| 42 | 42 | */ |
| 43 | - self::$config = include( 'src/CalendarSettings/Jalali.php' ); |
|
| 43 | + self::$config = include('src/CalendarSettings/Jalali.php'); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Fetch translated expression to langTable attribute |
| 47 | 47 | */ |
| 48 | - self::$langTable = include( 'lang/' . $language . '/general.php' ); |
|
| 48 | + self::$langTable = include('lang/'.$language.'/general.php'); |
|
| 49 | 49 | |
| 50 | - foreach( self::$langTable as $key => $translate ){ |
|
| 50 | + foreach (self::$langTable as $key => $translate) { |
|
| 51 | 51 | |
| 52 | - if ( isset( self::$config[ $key ] ) ) { |
|
| 52 | + if (isset(self::$config[$key])) { |
|
| 53 | 53 | |
| 54 | - if ( self::$config[ $key ] ) { |
|
| 54 | + if (self::$config[$key]) { |
|
| 55 | 55 | |
| 56 | - self::$config[ $key ] = $translate; |
|
| 56 | + self::$config[$key] = $translate; |
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
@@ -6,6 +6,6 @@ |
||
| 6 | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'OpenCafe\\Tools\\' => array($baseDir . '/src'), |
|
| 10 | - 'OpenCafe\\' => array($baseDir . '/src', $baseDir . '/src/Events'), |
|
| 9 | + 'OpenCafe\\Tools\\' => array($baseDir.'/src'), |
|
| 10 | + 'OpenCafe\\' => array($baseDir.'/src', $baseDir.'/src/Events'), |
|
| 11 | 11 | ); |
@@ -6,11 +6,11 @@ |
||
| 6 | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'OpenCafe\\Datium' => $baseDir . '/src/Datium.php', |
|
| 10 | - 'OpenCafe\\Events' => $baseDir . '/src/Events/Events.php', |
|
| 11 | - 'OpenCafe\\Face\\iEvents' => $baseDir . '/src/Events/iEvents.php', |
|
| 12 | - 'OpenCafe\\Tools\\Convert' => $baseDir . '/src/Convert.php', |
|
| 13 | - 'OpenCafe\\Tools\\DayOf' => $baseDir . '/src/DayOf.php', |
|
| 14 | - 'OpenCafe\\Tools\\Lang' => $baseDir . '/src/Lang.php', |
|
| 15 | - 'OpenCafe\\Tools\\Leap' => $baseDir . '/src/Leap.php', |
|
| 9 | + 'OpenCafe\\Datium' => $baseDir.'/src/Datium.php', |
|
| 10 | + 'OpenCafe\\Events' => $baseDir.'/src/Events/Events.php', |
|
| 11 | + 'OpenCafe\\Face\\iEvents' => $baseDir.'/src/Events/iEvents.php', |
|
| 12 | + 'OpenCafe\\Tools\\Convert' => $baseDir.'/src/Convert.php', |
|
| 13 | + 'OpenCafe\\Tools\\DayOf' => $baseDir.'/src/DayOf.php', |
|
| 14 | + 'OpenCafe\\Tools\\Lang' => $baseDir.'/src/Lang.php', |
|
| 15 | + 'OpenCafe\\Tools\\Leap' => $baseDir.'/src/Leap.php', |
|
| 16 | 16 | ); |