@@ -80,17 +80,17 @@ discard block |
||
| 80 | 80 | |
| 81 | 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 | 95 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
| 96 | 96 | |
@@ -98,11 +98,11 @@ discard block |
||
| 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 | 107 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
| 108 | 108 | |
@@ -131,17 +131,17 @@ discard block |
||
| 131 | 131 | |
| 132 | 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,12 +170,12 @@ 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 | 180 | self::$static_date_time = func_get_arg(0); |
| 181 | 181 | |
@@ -183,7 +183,7 @@ discard block |
||
| 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,46 +366,46 @@ 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 | - $this->translate_from_file = include( 'Lang/en/general.php' ); |
|
| 371 | + $this->translate_from_file = include('Lang/en/general.php'); |
|
| 372 | 372 | |
| 373 | - $this->translate_to_file = include( 'Lang/' . $this->language . '/general.php' ); |
|
| 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 | |
| 406 | - foreach( $this->translate_to_file as $key => $value ) { |
|
| 406 | + foreach ($this->translate_to_file as $key => $value) { |
|
| 407 | 407 | |
| 408 | - $string_date = str_replace( $this->translate_from_file[ $key ], $this->translate_to_file[ $key ], $string_date ); |
|
| 408 | + $string_date = str_replace($this->translate_from_file[$key], $this->translate_to_file[$key], $string_date); |
|
| 409 | 409 | |
| 410 | 410 | } |
| 411 | 411 | |
@@ -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,7 +35,7 @@ discard block |
||
| 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 |
@@ -45,15 +45,15 @@ discard block |
||
| 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 | |
@@ -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 | |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | 'pm_time' => 'ب.ظ', |
| 42 | 42 | |
| 43 | - 'end_of_days' => array( "" ), |
|
| 43 | + 'end_of_days' => array(""), |
|
| 44 | 44 | |
| 45 | - 'numbers' => array( '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' ), |
|
| 45 | + 'numbers' => array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'), |
|
| 46 | 46 | '0' => '۰', |
| 47 | 47 | '1' => '۱', |
| 48 | 48 | '2' => '۲', |