@@ -72,17 +72,17 @@ discard block |
||
72 | 72 | |
73 | 73 | $this->config = include('Config.php'); |
74 | 74 | |
75 | - $this->calendar_type = $this->config[ 'default_calendar' ]; |
|
75 | + $this->calendar_type = $this->config['default_calendar']; |
|
76 | 76 | |
77 | - date_default_timezone_set( $this->config['timezone'] ); |
|
77 | + date_default_timezone_set($this->config['timezone']); |
|
78 | 78 | |
79 | 79 | $this->calendar_type = 'gregorian'; |
80 | 80 | |
81 | - switch( Datium::$call_type ) { |
|
81 | + switch (Datium::$call_type) { |
|
82 | 82 | |
83 | 83 | case 'now': |
84 | 84 | |
85 | - $this->date_time = new DateTime( 'now' ); |
|
85 | + $this->date_time = new DateTime('now'); |
|
86 | 86 | |
87 | 87 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
88 | 88 | |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | |
91 | 91 | case 'make': |
92 | 92 | |
93 | - $this->date_time = new DateTime( 'now' ); |
|
93 | + $this->date_time = new DateTime('now'); |
|
94 | 94 | |
95 | - $this->date_time->setDate( self::$array_date['year'], self::$array_date['month'], self::$array_date['day'] ); |
|
95 | + $this->date_time->setDate(self::$array_date['year'], self::$array_date['month'], self::$array_date['day']); |
|
96 | 96 | |
97 | - $this->date_time->setTime( self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second'] ); |
|
97 | + $this->date_time->setTime(self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second']); |
|
98 | 98 | |
99 | 99 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
100 | 100 | |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | |
124 | 124 | return (object) array( |
125 | 125 | |
126 | - 'second' => $this->date_time->format( 's' ), |
|
126 | + 'second' => $this->date_time->format('s'), |
|
127 | 127 | |
128 | - 'minute' => $this->date_time->format( 'm' ), |
|
128 | + 'minute' => $this->date_time->format('m'), |
|
129 | 129 | |
130 | - 'hour' => $this->date_time->format( 'H' ), |
|
130 | + 'hour' => $this->date_time->format('H'), |
|
131 | 131 | |
132 | - 'day' => $this->date_time->format( 'd' ), |
|
132 | + 'day' => $this->date_time->format('d'), |
|
133 | 133 | |
134 | - 'month' => $this->date_time->format( 'm' ), |
|
134 | + 'month' => $this->date_time->format('m'), |
|
135 | 135 | |
136 | - 'year' => $this->date_time->format( 'Y' ) |
|
136 | + 'year' => $this->date_time->format('Y') |
|
137 | 137 | |
138 | 138 | ); |
139 | 139 | |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | * @param $second integer |
163 | 163 | * @return object |
164 | 164 | */ |
165 | - public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) { |
|
165 | + public static function create($year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) { |
|
166 | 166 | |
167 | 167 | /** |
168 | 168 | * When we want to set a Datetime object to Datium |
169 | 169 | */ |
170 | - if( func_num_args() === 1 ) { |
|
170 | + if (func_num_args() === 1) { |
|
171 | 171 | |
172 | 172 | self::$static_date_time = func_get_arg(0); |
173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | } else { |
177 | 177 | |
178 | - self::$array_date = array( 'year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second ); |
|
178 | + self::$array_date = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second); |
|
179 | 179 | |
180 | 180 | self::$call_type = 'make'; |
181 | 181 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | } |
187 | 187 | |
188 | - public static function between( $date_start, $date_end ) { |
|
188 | + public static function between($date_start, $date_end) { |
|
189 | 189 | |
190 | 190 | self::$date_start = $date_start; |
191 | 191 | |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | /** |
201 | 201 | * Convert from current calendar, what type is current calendar? |
202 | 202 | */ |
203 | - public function from( $calendar ) { |
|
203 | + public function from($calendar) { |
|
204 | 204 | |
205 | - $this->convert = new Convert( $this->date_time ); |
|
205 | + $this->convert = new Convert($this->date_time); |
|
206 | 206 | |
207 | - $this->date_time = $this->convert->from( $calendar ); |
|
207 | + $this->date_time = $this->convert->from($calendar); |
|
208 | 208 | |
209 | 209 | |
210 | 210 | /** |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | |
219 | 219 | } |
220 | 220 | |
221 | - public function to( $calendar ) { |
|
221 | + public function to($calendar) { |
|
222 | 222 | |
223 | - $this->convert = new Convert( $this->date_time ); |
|
223 | + $this->convert = new Convert($this->date_time); |
|
224 | 224 | |
225 | - $this->date_time = $this->convert->to( $calendar ); |
|
225 | + $this->date_time = $this->convert->to($calendar); |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * We need this part for DayOf class |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | * @param $start datetime |
242 | 242 | * @param $end datetime |
243 | 243 | */ |
244 | - public static function diff( $start, $end ) { |
|
244 | + public static function diff($start, $end) { |
|
245 | 245 | |
246 | - return date_diff( $start, $end ); |
|
246 | + return date_diff($start, $end); |
|
247 | 247 | |
248 | 248 | } |
249 | 249 | |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | * @param $value string |
253 | 253 | * @return object |
254 | 254 | */ |
255 | - public function add( $value ) { |
|
255 | + public function add($value) { |
|
256 | 256 | |
257 | - $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value ); |
|
257 | + $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value); |
|
258 | 258 | |
259 | - $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression ); |
|
259 | + $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression); |
|
260 | 260 | |
261 | - $this->date_time->add( new DateInterval( $this->date_interval_expression ) ); |
|
261 | + $this->date_time->add(new DateInterval($this->date_interval_expression)); |
|
262 | 262 | |
263 | 263 | return $this; |
264 | 264 | |
@@ -269,13 +269,13 @@ discard block |
||
269 | 269 | * @param $value |
270 | 270 | * @return obejct |
271 | 271 | */ |
272 | - public function sub( $value ) { |
|
272 | + public function sub($value) { |
|
273 | 273 | |
274 | - $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value ); |
|
274 | + $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value); |
|
275 | 275 | |
276 | - $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression ); |
|
276 | + $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression); |
|
277 | 277 | |
278 | - $this->date_time->sub( new DateInterval( $this->date_interval_expression ) ); |
|
278 | + $this->date_time->sub(new DateInterval($this->date_interval_expression)); |
|
279 | 279 | |
280 | 280 | return $this; |
281 | 281 | |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | * Check if current year is leap or not |
286 | 286 | * @return boolean |
287 | 287 | */ |
288 | - public function leap( $type = 'gregorian') { |
|
288 | + public function leap($type = 'gregorian') { |
|
289 | 289 | |
290 | - $this->leap = new Leap( $this->date_time->format( 'Y' ), $type ); |
|
290 | + $this->leap = new Leap($this->date_time->format('Y'), $type); |
|
291 | 291 | |
292 | 292 | return $this->leap; |
293 | 293 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | */ |
299 | 299 | public function dayOf() { |
300 | 300 | |
301 | - $this->day_of = new DayOf( $this->date_time, $this->calendar_type ); |
|
301 | + $this->day_of = new DayOf($this->date_time, $this->calendar_type); |
|
302 | 302 | |
303 | 303 | return $this->day_of; |
304 | 304 | |
@@ -309,13 +309,13 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function events() { |
311 | 311 | |
312 | - if ( Datium::$call_type == 'between' ) { |
|
312 | + if (Datium::$call_type == 'between') { |
|
313 | 313 | |
314 | - $this->events = new Events( Datium::$date_start, Datium::$date_end ); |
|
314 | + $this->events = new Events(Datium::$date_start, Datium::$date_end); |
|
315 | 315 | |
316 | 316 | } else { |
317 | 317 | |
318 | - $this->events = new Events( $this->date_time ); |
|
318 | + $this->events = new Events($this->date_time); |
|
319 | 319 | |
320 | 320 | } |
321 | 321 | |
@@ -332,17 +332,17 @@ discard block |
||
332 | 332 | * |
333 | 333 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
334 | 334 | */ |
335 | - public function object(){ |
|
335 | + public function object() { |
|
336 | 336 | |
337 | 337 | return $this->date_time; |
338 | 338 | |
339 | 339 | } |
340 | 340 | |
341 | - public function lang( $language = 'fa' ){ |
|
341 | + public function lang($language = 'fa') { |
|
342 | 342 | |
343 | 343 | $this->result = new Lang(); |
344 | 344 | |
345 | - $this->result->setConfig( $language ); |
|
345 | + $this->result->setConfig($language); |
|
346 | 346 | |
347 | 347 | $this->toConfig = $this->result->getConfig(); |
348 | 348 | |
@@ -356,29 +356,29 @@ discard block |
||
356 | 356 | * @param $calendar string |
357 | 357 | * @param $format string |
358 | 358 | */ |
359 | - public function get( $format = 'Y-m-d H:i:s' ) { |
|
359 | + public function get($format = 'Y-m-d H:i:s') { |
|
360 | 360 | |
361 | - if( is_null( $this->fromConfig ) ) |
|
362 | - $this->fromConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_from ) . '.php' ); |
|
361 | + if (is_null($this->fromConfig)) |
|
362 | + $this->fromConfig = include('CalendarSettings/'.ucfirst($this->translate_from).'.php'); |
|
363 | 363 | |
364 | - if( is_null( $this->toConfig ) ) |
|
365 | - $this->toConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_to ) . '.php' ); |
|
364 | + if (is_null($this->toConfig)) |
|
365 | + $this->toConfig = include('CalendarSettings/'.ucfirst($this->translate_to).'.php'); |
|
366 | 366 | |
367 | - $string_date = $this->date_time->format( $format ); |
|
367 | + $string_date = $this->date_time->format($format); |
|
368 | 368 | |
369 | - if( $this->translate_to != 'gregorian' ) { |
|
369 | + if ($this->translate_to != 'gregorian') { |
|
370 | 370 | |
371 | - $string_date = str_replace( $this->fromConfig['month'], $this->toConfig['month'], $string_date ); |
|
371 | + $string_date = str_replace($this->fromConfig['month'], $this->toConfig['month'], $string_date); |
|
372 | 372 | |
373 | - $string_date = str_replace( $this->fromConfig['days_of_week'], $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], $string_date ); |
|
373 | + $string_date = str_replace($this->fromConfig['days_of_week'], $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], $string_date); |
|
374 | 374 | |
375 | - $string_date = str_replace( $this->fromConfig['numbers'], $this->toConfig['numbers'], $string_date ); |
|
375 | + $string_date = str_replace($this->fromConfig['numbers'], $this->toConfig['numbers'], $string_date); |
|
376 | 376 | |
377 | - $string_date = str_replace( $this->fromConfig['day_to_nigh'], $this->toConfig['day_to_nigh'], $string_date ); |
|
377 | + $string_date = str_replace($this->fromConfig['day_to_nigh'], $this->toConfig['day_to_nigh'], $string_date); |
|
378 | 378 | |
379 | - $string_date = str_replace( $this->fromConfig['night_to_day'], $this->toConfig['night_to_day'], $string_date ); |
|
379 | + $string_date = str_replace($this->fromConfig['night_to_day'], $this->toConfig['night_to_day'], $string_date); |
|
380 | 380 | |
381 | - $string_date = str_replace( $this->fromConfig['end_of_days_number'], $this->toConfig['end_of_days_number'], $string_date ); |
|
381 | + $string_date = str_replace($this->fromConfig['end_of_days_number'], $this->toConfig['end_of_days_number'], $string_date); |
|
382 | 382 | |
383 | 383 | |
384 | 384 | } |