@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | public function all() |
172 | 172 | { |
173 | 173 | |
174 | - return ( object )array( |
|
174 | + return (object) array( |
|
175 | 175 | |
176 | 176 | 'second' => $this->date_time->format('s'), |
177 | 177 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | $difference->year = $difference->y; |
393 | 393 | |
394 | - $difference->simple = ( new SimpleDiff( $start, $end, $difference ) ); |
|
394 | + $difference->simple = (new SimpleDiff($start, $end, $difference)); |
|
395 | 395 | |
396 | 396 | return $difference; |
397 | 397 | |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | public function get($format = 'Y-m-d H:i:s') |
591 | 591 | { |
592 | 592 | |
593 | - if( $format === 'timestamp' ) { |
|
593 | + if ($format === 'timestamp') { |
|
594 | 594 | |
595 | 595 | return $this->timestamp(); |
596 | 596 |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * Fetch translated file to config attribute |
46 | 46 | */ |
47 | - self::$config = include __DIR__ . '/CalendarSettings/Jalali.php'; |
|
47 | + self::$config = include __DIR__.'/CalendarSettings/Jalali.php'; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Fetch translated expression to langTable attribute |
51 | 51 | */ |
52 | - self::$langTable = include __DIR__ . '/lang/' . $language . '/general.php'; |
|
52 | + self::$langTable = include __DIR__.'/lang/'.$language.'/general.php'; |
|
53 | 53 | |
54 | 54 | foreach (self::$langTable as $key => $translate) { |
55 | - if (isset(self::$config[ $key ])) { |
|
56 | - if (self::$config[ $key ]) { |
|
57 | - self::$config[ $key ] = $translate; |
|
55 | + if (isset(self::$config[$key])) { |
|
56 | + if (self::$config[$key]) { |
|
57 | + self::$config[$key] = $translate; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public static function get($lang, $value) |
72 | 72 | { |
73 | 73 | |
74 | - $file = include( __DIR__ . '/lang/' . $lang . '/general.php'); |
|
74 | + $file = include(__DIR__.'/lang/'.$lang.'/general.php'); |
|
75 | 75 | |
76 | 76 | return $file[$value]; |
77 | 77 | |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | * @param integer $numbers |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - public static function getNumbers( $lang, $numbers ) |
|
86 | + public static function getNumbers($lang, $numbers) |
|
87 | 87 | { |
88 | 88 | |
89 | 89 | $result = null; |
90 | 90 | |
91 | - $file = include( __DIR__ . '/lang/' . $lang . '/general.php'); |
|
91 | + $file = include(__DIR__.'/lang/'.$lang.'/general.php'); |
|
92 | 92 | |
93 | - foreach( str_split( $numbers, 1 ) as $key => $value ) { |
|
93 | + foreach (str_split($numbers, 1) as $key => $value) { |
|
94 | 94 | |
95 | 95 | $result .= $file[$value]; |
96 | 96 |
@@ -7,30 +7,30 @@ discard block |
||
7 | 7 | */ |
8 | 8 | class DayOf |
9 | 9 | { |
10 | - /** |
|
11 | - * @var object |
|
12 | - */ |
|
10 | + /** |
|
11 | + * @var object |
|
12 | + */ |
|
13 | 13 | protected $date_time; |
14 | 14 | |
15 | - /** |
|
16 | - * @var array |
|
17 | - */ |
|
15 | + /** |
|
16 | + * @var array |
|
17 | + */ |
|
18 | 18 | protected $config; |
19 | 19 | |
20 | - /** |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - protected $calendar_type; |
|
20 | + /** |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + protected $calendar_type; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Constructor of DayOf class |
|
27 | - */ |
|
25 | + /** |
|
26 | + * Constructor of DayOf class |
|
27 | + */ |
|
28 | 28 | public function __construct($date_time, $calendar_type = 'gregorian') |
29 | 29 | { |
30 | 30 | |
31 | - $this->config = include __DIR__.'/CalendarSettings/' . ucfirst($calendar_type) . '.php'; |
|
31 | + $this->config = include __DIR__.'/CalendarSettings/' . ucfirst($calendar_type) . '.php'; |
|
32 | 32 | |
33 | - $this->calendar_type = $calendar_type; |
|
33 | + $this->calendar_type = $calendar_type; |
|
34 | 34 | |
35 | 35 | $this->date_time = $date_time; |
36 | 36 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * Which day of year is current day. |
|
43 | - * |
|
44 | - * @since Aug, 03 2015 |
|
45 | - * @return integer |
|
46 | - */ |
|
42 | + * Which day of year is current day. |
|
43 | + * |
|
44 | + * @since Aug, 03 2015 |
|
45 | + * @return integer |
|
46 | + */ |
|
47 | 47 | public function year() |
48 | 48 | { |
49 | 49 | |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | |
54 | 54 | |
55 | 55 | /** |
56 | - * Which day of week is current day. |
|
57 | - * |
|
58 | - * @since Aug, 09 2015 |
|
59 | - * @return integer |
|
60 | - */ |
|
56 | + * Which day of week is current day. |
|
57 | + * |
|
58 | + * @since Aug, 09 2015 |
|
59 | + * @return integer |
|
60 | + */ |
|
61 | 61 | public function week() |
62 | 62 | { |
63 | 63 | |
@@ -65,45 +65,45 @@ discard block |
||
65 | 65 | |
66 | 66 | } |
67 | 67 | |
68 | - /** |
|
69 | - * Return last day of current month |
|
70 | - * |
|
71 | - * @since Oct, 18 2016 |
|
72 | - * @return integer |
|
73 | - */ |
|
74 | - public function lastDayMonth() { |
|
68 | + /** |
|
69 | + * Return last day of current month |
|
70 | + * |
|
71 | + * @since Oct, 18 2016 |
|
72 | + * @return integer |
|
73 | + */ |
|
74 | + public function lastDayMonth() { |
|
75 | 75 | |
76 | - $days = 0; |
|
76 | + $days = 0; |
|
77 | 77 | |
78 | - switch ( $this->calendar_type ) { |
|
78 | + switch ( $this->calendar_type ) { |
|
79 | 79 | |
80 | - case 'gregorian': |
|
80 | + case 'gregorian': |
|
81 | 81 | |
82 | - $days = ( intval( $this->date_time->format( 'm' ) ) == 2 && |
|
83 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
84 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
85 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
82 | + $days = ( intval( $this->date_time->format( 'm' ) ) == 2 && |
|
83 | + $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
84 | + $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
85 | + $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
86 | 86 | |
87 | - break; |
|
87 | + break; |
|
88 | 88 | |
89 | - case 'jalali': |
|
89 | + case 'jalali': |
|
90 | 90 | |
91 | - $days = ( intval( $this->date_time->format( 'm' ) ) == 12 && |
|
92 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
93 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
94 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
91 | + $days = ( intval( $this->date_time->format( 'm' ) ) == 12 && |
|
92 | + $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
93 | + $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
94 | + $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
95 | 95 | |
96 | - break; |
|
96 | + break; |
|
97 | 97 | |
98 | - default: |
|
98 | + default: |
|
99 | 99 | |
100 | - $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
100 | + $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
101 | 101 | |
102 | - break; |
|
102 | + break; |
|
103 | 103 | |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | - return $days; |
|
106 | + return $days; |
|
107 | 107 | |
108 | - } |
|
108 | + } |
|
109 | 109 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct($date_time, $calendar_type = 'gregorian') |
29 | 29 | { |
30 | 30 | |
31 | - $this->config = include __DIR__.'/CalendarSettings/' . ucfirst($calendar_type) . '.php'; |
|
31 | + $this->config = include __DIR__.'/CalendarSettings/'.ucfirst($calendar_type).'.php'; |
|
32 | 32 | |
33 | 33 | $this->calendar_type = $calendar_type; |
34 | 34 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function year() |
48 | 48 | { |
49 | 49 | |
50 | - return $this->config[ 'day_of_year' ]( $this->date_time ); |
|
50 | + return $this->config['day_of_year']($this->date_time); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function week() |
62 | 62 | { |
63 | 63 | |
64 | - return $this->config[ 'day_of_week' ]( $this->date_time ); |
|
64 | + return $this->config['day_of_week']($this->date_time); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -75,29 +75,27 @@ discard block |
||
75 | 75 | |
76 | 76 | $days = 0; |
77 | 77 | |
78 | - switch ( $this->calendar_type ) { |
|
78 | + switch ($this->calendar_type) { |
|
79 | 79 | |
80 | 80 | case 'gregorian': |
81 | 81 | |
82 | - $days = ( intval( $this->date_time->format( 'm' ) ) == 2 && |
|
83 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
84 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
85 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
82 | + $days = (intval($this->date_time->format('m')) == 2 && |
|
83 | + $this->config['leap_year']($this->date_time->format('Y'))) ? |
|
84 | + $this->config['month_days_number'][intval($this->date_time->format('m'))] + 1 : $this->config['month_days_number'][intval($this->date_time->format('m'))]; |
|
86 | 85 | |
87 | 86 | break; |
88 | 87 | |
89 | 88 | case 'jalali': |
90 | 89 | |
91 | - $days = ( intval( $this->date_time->format( 'm' ) ) == 12 && |
|
92 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
93 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
94 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
90 | + $days = (intval($this->date_time->format('m')) == 12 && |
|
91 | + $this->config['leap_year']($this->date_time->format('Y'))) ? |
|
92 | + $this->config['month_days_number'][intval($this->date_time->format('m'))] + 1 : $this->config['month_days_number'][intval($this->date_time->format('m'))]; |
|
95 | 93 | |
96 | 94 | break; |
97 | 95 | |
98 | 96 | default: |
99 | 97 | |
100 | - $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
98 | + $days = $this->config['month_days_number'][intval($this->date_time->format('m'))]; |
|
101 | 99 | |
102 | 100 | break; |
103 | 101 |