@@ -2,23 +2,23 @@ |
||
2 | 2 | |
3 | 3 | return array( |
4 | 4 | |
5 | - 'events' => array( 'eid fitr' => 'عيد الفطر', |
|
5 | + 'events' => array( 'eid fitr' => 'عيد الفطر', |
|
6 | 6 | |
7 | 7 | ), |
8 | 8 | |
9 | 9 | 'month' => array( |
10 | 10 | 'مُحَرَّم', |
11 | 11 | 'صَفَر', |
12 | - 'رَبيع الأوّل', |
|
13 | - 'رَبيع الآخر', |
|
14 | - 'جُمادى الأولى', |
|
15 | - 'جُمادى الآخرة', |
|
16 | - 'رَجَب', |
|
17 | - 'شَعْبان', |
|
18 | - 'رَمَضان', |
|
19 | - 'شَوّال', |
|
20 | - 'ذو القِعْدة', |
|
21 | - 'ذو الحِجّة' |
|
12 | + 'رَبيع الأوّل', |
|
13 | + 'رَبيع الآخر', |
|
14 | + 'جُمادى الأولى', |
|
15 | + 'جُمادى الآخرة', |
|
16 | + 'رَجَب', |
|
17 | + 'شَعْبان', |
|
18 | + 'رَمَضان', |
|
19 | + 'شَوّال', |
|
20 | + 'ذو القِعْدة', |
|
21 | + 'ذو الحِجّة' |
|
22 | 22 | ), |
23 | 23 | |
24 | 24 | 'days_of_week' => array( |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - use OpenCafe\Datium as Datium; |
|
3 | + use OpenCafe\Datium as Datium; |
|
4 | 4 | |
5 | - return [ |
|
5 | + return [ |
|
6 | 6 | |
7 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
7 | + 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
8 | 8 | |
9 | - 'am_time' => 'AM', |
|
9 | + 'am_time' => 'AM', |
|
10 | 10 | |
11 | - 'pm_time' => 'PM', |
|
11 | + 'pm_time' => 'PM', |
|
12 | 12 | |
13 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
13 | + 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | - /************************************************************ |
|
17 | + /************************************************************ |
|
18 | 18 | * Convert to |
19 | 19 | ************************************************************ |
20 | 20 | * |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | * |
23 | 23 | *\_________________________________________________________/ |
24 | 24 | */ |
25 | - 'convert_to' => function ($date_time) { |
|
25 | + 'convert_to' => function ($date_time) { |
|
26 | 26 | |
27 | - return null; |
|
27 | + return null; |
|
28 | 28 | |
29 | - }, |
|
29 | + }, |
|
30 | 30 | |
31 | 31 | /************************************************************ |
32 | 32 | * Convert From |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | 'December' |
88 | 88 | |
89 | - ), |
|
89 | + ), |
|
90 | 90 | |
91 | 91 | /************************************************************ |
92 | 92 | * Days of Week |
@@ -99,28 +99,28 @@ discard block |
||
99 | 99 | */ |
100 | 100 | 'days_of_week' => array ( |
101 | 101 | |
102 | - 'Monday', |
|
103 | - 'Tuesday', |
|
104 | - 'Wednesday', |
|
105 | - 'Thursday', |
|
106 | - 'Friday', |
|
107 | - 'Saturday', |
|
108 | - 'Sunday', |
|
102 | + 'Monday', |
|
103 | + 'Tuesday', |
|
104 | + 'Wednesday', |
|
105 | + 'Thursday', |
|
106 | + 'Friday', |
|
107 | + 'Saturday', |
|
108 | + 'Sunday', |
|
109 | 109 | ), |
110 | 110 | |
111 | 111 | |
112 | 112 | 'month_days_number' => array( 1 => 31, |
113 | - 2 => 28, |
|
114 | - 3 => 31, |
|
115 | - 4 => 30, |
|
116 | - 5 => 31, |
|
117 | - 6 => 30, |
|
118 | - 7 => 31, |
|
119 | - 8 => 31, |
|
120 | - 9 => 30, |
|
121 | - 10 => 31, |
|
122 | - 11 => 30, |
|
123 | - 12 => 30 ), |
|
113 | + 2 => 28, |
|
114 | + 3 => 31, |
|
115 | + 4 => 30, |
|
116 | + 5 => 31, |
|
117 | + 6 => 30, |
|
118 | + 7 => 31, |
|
119 | + 8 => 31, |
|
120 | + 9 => 30, |
|
121 | + 10 => 31, |
|
122 | + 11 => 30, |
|
123 | + 12 => 30 ), |
|
124 | 124 | |
125 | 125 | |
126 | 126 | 'day_of_year' => function ($date_time) { |
@@ -7,43 +7,43 @@ |
||
7 | 7 | { |
8 | 8 | |
9 | 9 | /** |
10 | - * @param integer store year value |
|
11 | - */ |
|
10 | + * @param integer store year value |
|
11 | + */ |
|
12 | 12 | protected $year; |
13 | 13 | |
14 | 14 | /** |
15 | - * @param string store type of year value |
|
16 | - */ |
|
15 | + * @param string store type of year value |
|
16 | + */ |
|
17 | 17 | protected $type; |
18 | 18 | |
19 | 19 | /** |
20 | - * @param boolean store result of leap functions |
|
21 | - */ |
|
20 | + * @param boolean store result of leap functions |
|
21 | + */ |
|
22 | 22 | protected $result; |
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
26 | - * @param $year integer |
|
27 | - * @since Aug, 21 2015 |
|
28 | - */ |
|
26 | + * @param $year integer |
|
27 | + * @since Aug, 21 2015 |
|
28 | + */ |
|
29 | 29 | public function __construct($year, $type = 'gregorian') |
30 | 30 | { |
31 | 31 | |
32 | - $this->year = $year; |
|
32 | + $this->year = $year; |
|
33 | 33 | |
34 | - $this->type = $type; |
|
34 | + $this->type = $type; |
|
35 | 35 | |
36 | - return $this; |
|
36 | + return $this; |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
42 | - * return the year is leap or not |
|
43 | - * |
|
44 | - * @since Aug, 21 2015 |
|
45 | - * @return boolean |
|
46 | - */ |
|
42 | + * return the year is leap or not |
|
43 | + * |
|
44 | + * @since Aug, 21 2015 |
|
45 | + * @return boolean |
|
46 | + */ |
|
47 | 47 | public function get() |
48 | 48 | { |
49 | 49 |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | private $blockList; |
33 | 33 | |
34 | 34 | /** |
35 | - * SimpleDiff Class constructure |
|
36 | - * |
|
37 | - * @param DateTime $time_difference The time to calculate with now |
|
38 | - * @param string $lang Language |
|
39 | - */ |
|
35 | + * SimpleDiff Class constructure |
|
36 | + * |
|
37 | + * @param DateTime $time_difference The time to calculate with now |
|
38 | + * @param string $lang Language |
|
39 | + */ |
|
40 | 40 | public function __construct($start, $end, $difference ) |
41 | 41 | { |
42 | 42 | |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | - * Return difference period as an object |
|
55 | - * |
|
56 | - * @return object |
|
57 | - */ |
|
54 | + * Return difference period as an object |
|
55 | + * |
|
56 | + * @return object |
|
57 | + */ |
|
58 | 58 | public function all() |
59 | 59 | { |
60 | 60 | |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * Read ago config file |
|
67 | - * |
|
68 | - * @param integer $date date index in ago config file |
|
69 | - * @param string $type duration type on ago config file |
|
70 | - */ |
|
66 | + * Read ago config file |
|
67 | + * |
|
68 | + * @param integer $date date index in ago config file |
|
69 | + * @param string $type duration type on ago config file |
|
70 | + */ |
|
71 | 71 | public function read( $value, $type ) |
72 | 72 | { |
73 | 73 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if( array_key_exists( $value, $config[ $type ] ) ) { |
99 | 99 | |
100 | 100 | $str = Lang::get( $this->language, $config[ $type ][ $value ] ) |
101 | - . $time; |
|
101 | + . $time; |
|
102 | 102 | |
103 | 103 | return $str; |
104 | 104 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | - * Show priority of duration |
|
118 | - * |
|
119 | - * @param integer $date date index in ago config file |
|
120 | - * @param string $type duration type on ago config file |
|
121 | - */ |
|
117 | + * Show priority of duration |
|
118 | + * |
|
119 | + * @param integer $date date index in ago config file |
|
120 | + * @param string $type duration type on ago config file |
|
121 | + */ |
|
122 | 122 | public function priority( $date, $type ) |
123 | 123 | { |
124 | 124 | |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | - * Return fainal SimpleDiff result |
|
148 | - * |
|
149 | - * @return string |
|
150 | - */ |
|
147 | + * Return fainal SimpleDiff result |
|
148 | + * |
|
149 | + * @return string |
|
150 | + */ |
|
151 | 151 | public function get() |
152 | 152 | { |
153 | 153 |
@@ -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 | } |
@@ -12,48 +12,48 @@ discard block |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | /** |
15 | - * @var integer |
|
16 | - */ |
|
15 | + * @var integer |
|
16 | + */ |
|
17 | 17 | protected $year; |
18 | 18 | |
19 | 19 | /** |
20 | - * @var integer |
|
21 | - */ |
|
20 | + * @var integer |
|
21 | + */ |
|
22 | 22 | protected $month; |
23 | 23 | |
24 | 24 | /** |
25 | - * @var $day |
|
26 | - */ |
|
25 | + * @var $day |
|
26 | + */ |
|
27 | 27 | protected $day; |
28 | 28 | |
29 | 29 | /** |
30 | - * @var DateTime |
|
31 | - */ |
|
30 | + * @var DateTime |
|
31 | + */ |
|
32 | 32 | public $date_time; |
33 | 33 | |
34 | 34 | /** |
35 | - * @var array |
|
36 | - */ |
|
35 | + * @var array |
|
36 | + */ |
|
37 | 37 | protected $config; |
38 | 38 | |
39 | 39 | /** |
40 | - * @var integer |
|
41 | - */ |
|
40 | + * @var integer |
|
41 | + */ |
|
42 | 42 | protected $leap; |
43 | 43 | |
44 | 44 | /** |
45 | - * @var integer |
|
46 | - */ |
|
45 | + * @var integer |
|
46 | + */ |
|
47 | 47 | protected $temp_day; |
48 | 48 | |
49 | 49 | /** |
50 | - * @var DateTime |
|
51 | - */ |
|
50 | + * @var DateTime |
|
51 | + */ |
|
52 | 52 | protected $date; |
53 | 53 | |
54 | 54 | /** |
55 | - * @var array |
|
56 | - */ |
|
55 | + * @var array |
|
56 | + */ |
|
57 | 57 | protected $calendar_file; |
58 | 58 | |
59 | 59 | /************************************************************ |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | - *convert jalali year to gregorian year |
|
106 | - * |
|
107 | - * @since Oct, 16 2015 |
|
108 | - * @return object |
|
109 | - */ |
|
105 | + *convert jalali year to gregorian year |
|
106 | + * |
|
107 | + * @since Oct, 16 2015 |
|
108 | + * @return object |
|
109 | + */ |
|
110 | 110 | public function jalaliToGregorian($date_time) |
111 | 111 | { |
112 | 112 | |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
164 | 164 | |
165 | 165 | |
166 | - return $this->date_time; |
|
166 | + return $this->date_time; |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
171 | - *convert jalali year to hijri year |
|
172 | - * |
|
173 | - * @since Oct, 17 2015 |
|
174 | - * @return object |
|
175 | - */ |
|
171 | + *convert jalali year to hijri year |
|
172 | + * |
|
173 | + * @since Oct, 17 2015 |
|
174 | + * @return object |
|
175 | + */ |
|
176 | 176 | public function jalaliToHijri($date_time) |
177 | 177 | { |
178 | 178 | |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | $this->temp_day += $this->config['month_days_number'][$i]; |
193 | 193 | } |
194 | 194 | |
195 | - $this->temp_day += $this->day; |
|
195 | + $this->temp_day += $this->day; |
|
196 | 196 | |
197 | - $this->leap = new Leap($this->year); |
|
197 | + $this->leap = new Leap($this->year); |
|
198 | 198 | |
199 | 199 | if ($this->leap->get() && $this->month > 11) { |
200 | 200 | $this->temp_day++; |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | |
209 | 209 | $_month = $_year[1]; |
210 | 210 | |
211 | - $var_temp = '0.0'; |
|
211 | + $var_temp = '0.0'; |
|
212 | 212 | |
213 | 213 | for ($i = strlen($_month); $i > 2; $i--) { |
214 | 214 | $var_temp .= '0'; |
215 | 215 | } |
216 | 216 | |
217 | - $var_temp .= '1'; |
|
217 | + $var_temp .= '1'; |
|
218 | 218 | |
219 | 219 | $_month = $_month * $var_temp ; |
220 | 220 | |
@@ -242,18 +242,18 @@ discard block |
||
242 | 242 | |
243 | 243 | $this->day = $_day[0]; |
244 | 244 | |
245 | - $this->date_time->setDate($this->year, $this->month, $this->day); |
|
245 | + $this->date_time->setDate($this->year, $this->month, $this->day); |
|
246 | 246 | |
247 | - return $this->date_time; |
|
247 | + return $this->date_time; |
|
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
252 | - *convert hijri year to jalali year |
|
253 | - * |
|
254 | - * @since Oct, 17 2015 |
|
255 | - * @return object |
|
256 | - */ |
|
252 | + *convert hijri year to jalali year |
|
253 | + * |
|
254 | + * @since Oct, 17 2015 |
|
255 | + * @return object |
|
256 | + */ |
|
257 | 257 | public function hijriToJalali($date_time) |
258 | 258 | { |
259 | 259 | |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | |
306 | 306 | $this->date_time->setDate($jalali_year, $jalali_month, $jalali_day); |
307 | 307 | |
308 | - return $this->date_time; |
|
308 | + return $this->date_time; |
|
309 | 309 | |
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
313 | - * convert hijri year to gregorian year |
|
314 | - * |
|
315 | - * @since Oct, 17 2015 |
|
316 | - * @return object |
|
317 | - */ |
|
313 | + * convert hijri year to gregorian year |
|
314 | + * |
|
315 | + * @since Oct, 17 2015 |
|
316 | + * @return object |
|
317 | + */ |
|
318 | 318 | public function hijriToGregorian($date_time) |
319 | 319 | { |
320 | 320 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
368 | 368 | |
369 | - return $this->date_time; |
|
369 | + return $this->date_time; |
|
370 | 370 | |
371 | 371 | } |
372 | 372 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | return array( |
4 | 4 | |
5 | - 'events' => array( 'nowruz' => 'عید نوروز', |
|
5 | + 'events' => array( 'nowruz' => 'عید نوروز', |
|
6 | 6 | |
7 | 7 | 'iran_national_day' => 'روز جمهوری اسلامی', |
8 | 8 | |
@@ -12,16 +12,16 @@ discard block |
||
12 | 12 | 'month' => array( |
13 | 13 | 'فروردین', |
14 | 14 | 'اردیبهشت', |
15 | - 'خرداد', |
|
16 | - 'تیر', |
|
17 | - 'مرداد', |
|
18 | - 'شهریور', |
|
19 | - 'مهر', |
|
20 | - 'آبان', |
|
21 | - 'آذر', |
|
22 | - 'دی', |
|
23 | - 'بهمن', |
|
24 | - 'اسفند', |
|
15 | + 'خرداد', |
|
16 | + 'تیر', |
|
17 | + 'مرداد', |
|
18 | + 'شهریور', |
|
19 | + 'مهر', |
|
20 | + 'آبان', |
|
21 | + 'آذر', |
|
22 | + 'دی', |
|
23 | + 'بهمن', |
|
24 | + 'اسفند', |
|
25 | 25 | ), |
26 | 26 | |
27 | 27 | 'days_of_week' => array( |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | return array ( |
7 | 7 | |
8 | - /************************************************************ |
|
8 | + /************************************************************ |
|
9 | 9 | * Convert to |
10 | 10 | ************************************************************ |
11 | 11 | * |
@@ -13,19 +13,19 @@ 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 | 30 | for ($i = 1; $i < $month; $i++) { |
31 | 31 | $temp_day += $config[ 'month_days_number' ][ $i ]; |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | $temp_day++; |
40 | 40 | } |
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 | |
@@ -55,37 +55,37 @@ discard block |
||
55 | 55 | |
56 | 56 | $var_temp .= '1'; |
57 | 57 | |
58 | - $_month = $_month * $var_temp ; |
|
58 | + $_month = $_month * $var_temp ; |
|
59 | 59 | |
60 | - $_month = ( $_month * 12 ) + 1; |
|
60 | + $_month = ( $_month * 12 ) + 1; |
|
61 | 61 | |
62 | - $_month = explode('.', $_month); |
|
62 | + $_month = explode('.', $_month); |
|
63 | 63 | |
64 | - $month = $_month[0]; |
|
64 | + $month = $_month[0]; |
|
65 | 65 | |
66 | - $_day = $_month[1]; |
|
66 | + $_day = $_month[1]; |
|
67 | 67 | |
68 | - $var_temp = '0.0'; |
|
68 | + $var_temp = '0.0'; |
|
69 | 69 | |
70 | 70 | for ($i = strlen($_day); $i > 2; $i--) { |
71 | 71 | $var_temp .= '0' ; |
72 | 72 | } |
73 | 73 | |
74 | - $var_temp .= '1'; |
|
74 | + $var_temp .= '1'; |
|
75 | 75 | |
76 | - $_day = $_day * $var_temp; |
|
76 | + $_day = $_day * $var_temp; |
|
77 | 77 | |
78 | - $_day = ( $_day * 29.530 ); |
|
78 | + $_day = ( $_day * 29.530 ); |
|
79 | 79 | |
80 | - $_day = explode('.', $_day); |
|
80 | + $_day = explode('.', $_day); |
|
81 | 81 | |
82 | - $day = $_day[0]; |
|
82 | + $day = $_day[0]; |
|
83 | 83 | |
84 | 84 | $date_time->setDate($year, $month, $day); |
85 | 85 | |
86 | 86 | return $date_time; |
87 | 87 | |
88 | - }, |
|
88 | + }, |
|
89 | 89 | |
90 | 90 | /************************************************************ |
91 | 91 | * Convert From |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | 'Dhu al_Hijjah' |
167 | 167 | |
168 | - ), |
|
168 | + ), |
|
169 | 169 | |
170 | 170 | /************************************************************ |
171 | 171 | * Days of Week |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | *\_________________________________________________________/ |
178 | 178 | */ |
179 | 179 | 'days_of_week' => array ( |
180 | - 'al-Aḥad', |
|
181 | - 'al-Ithnayn', |
|
182 | - 'ath-Thulatha\'', |
|
183 | - 'al-Arbi\'a', |
|
184 | - 'al-Khamees', |
|
185 | - 'al-Jumu\'ah', |
|
186 | - 'as-Sabt', |
|
180 | + 'al-Aḥad', |
|
181 | + 'al-Ithnayn', |
|
182 | + 'ath-Thulatha\'', |
|
183 | + 'al-Arbi\'a', |
|
184 | + 'al-Khamees', |
|
185 | + 'al-Jumu\'ah', |
|
186 | + 'as-Sabt', |
|
187 | 187 | |
188 | 188 | ), |
189 | 189 | |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | |
200 | 200 | |
201 | 201 | 'month_days_number' => array( 1 => 30, |
202 | - 2 => 29, |
|
203 | - 3 => 30, |
|
204 | - 4 => 30, |
|
205 | - 5 => 29, |
|
206 | - 6 => 29, |
|
207 | - 7 => 30, |
|
208 | - 8 => 29, |
|
209 | - 9 => 30, |
|
210 | - 10 => 29, |
|
211 | - 11 => 30, |
|
212 | - 12 => 30 ), |
|
202 | + 2 => 29, |
|
203 | + 3 => 30, |
|
204 | + 4 => 30, |
|
205 | + 5 => 29, |
|
206 | + 6 => 29, |
|
207 | + 7 => 30, |
|
208 | + 8 => 29, |
|
209 | + 9 => 30, |
|
210 | + 10 => 29, |
|
211 | + 11 => 30, |
|
212 | + 12 => 30 ), |
|
213 | 213 | /************************************************************ |
214 | 214 | * Day of year |
215 | 215 | ************************************************************ |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | *\_________________________________________________________/ |
220 | 220 | */ |
221 | - 'day_of_year' => function ($date_time) { |
|
221 | + 'day_of_year' => function ($date_time) { |
|
222 | 222 | |
223 | 223 | $result = null; |
224 | 224 | |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | |
239 | 239 | return $result; |
240 | 240 | |
241 | - }, |
|
241 | + }, |
|
242 | 242 | |
243 | - /************************************************************ |
|
243 | + /************************************************************ |
|
244 | 244 | * Day of week |
245 | 245 | ************************************************************ |
246 | 246 | * |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * example : al-Aḥad = result is 1 |
249 | 249 | *\_________________________________________________________/ |
250 | 250 | */ |
251 | - 'day_of_week' => function ($date_time) { |
|
251 | + 'day_of_week' => function ($date_time) { |
|
252 | 252 | |
253 | 253 | $configGhamari = include 'Hijri.php'; |
254 | 254 | |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | - }, |
|
267 | + }, |
|
268 | 268 | |
269 | - /************************************************************ |
|
269 | + /************************************************************ |
|
270 | 270 | * Leap year |
271 | 271 | ************************************************************ |
272 | 272 | * |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * |
275 | 275 | *\_________________________________________________________/ |
276 | 276 | */ |
277 | - 'leap_year' => function ($year) { |
|
277 | + 'leap_year' => function ($year) { |
|
278 | 278 | $result = $this->year % 30; |
279 | 279 | |
280 | 280 | if (( 2 == $result ) |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | ) { |
292 | 292 | return $result; |
293 | 293 | } |
294 | - }, |
|
294 | + }, |
|
295 | 295 | |
296 | 296 | /************************************************************ |
297 | 297 | * Weekend |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $temp_day += $config[ 'month_days_number' ][ $i ]; |
46 | 46 | } |
47 | 47 | |
48 | - $temp_day += $day; |
|
48 | + $temp_day += $day; |
|
49 | 49 | |
50 | - $leap = new Leap($year); |
|
50 | + $leap = new Leap($year); |
|
51 | 51 | |
52 | 52 | if ($leap->get() && $month > 2) { |
53 | 53 | $temp_day++; |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - $date_time->setDate($year, $month, $day); |
|
104 | + $date_time->setDate($year, $month, $day); |
|
105 | 105 | |
106 | - return $date_time; |
|
106 | + return $date_time; |
|
107 | 107 | |
108 | 108 | }, |
109 | 109 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
179 | 179 | |
180 | 180 | |
181 | - return $date_time; |
|
181 | + return $date_time; |
|
182 | 182 | |
183 | 183 | }, |
184 | 184 | |
@@ -241,30 +241,30 @@ discard block |
||
241 | 241 | |
242 | 242 | 'days_of_week' => array ( |
243 | 243 | |
244 | - 'Yekshanbe', |
|
245 | - 'Doshanbe', |
|
246 | - 'Seshanbe', |
|
247 | - 'Chaharshanbe', |
|
248 | - 'Panjshanbe', |
|
249 | - 'Jome', |
|
250 | - 'Shanbe', |
|
244 | + 'Yekshanbe', |
|
245 | + 'Doshanbe', |
|
246 | + 'Seshanbe', |
|
247 | + 'Chaharshanbe', |
|
248 | + 'Panjshanbe', |
|
249 | + 'Jome', |
|
250 | + 'Shanbe', |
|
251 | 251 | |
252 | 252 | ), |
253 | 253 | |
254 | 254 | 'start_day_of_week' => 'Shanbe', |
255 | 255 | |
256 | 256 | 'month_days_number' => array( 1 => 31, |
257 | - 2 => 31, |
|
258 | - 3 => 31, |
|
259 | - 4 => 31, |
|
260 | - 5 => 31, |
|
261 | - 6 => 31, |
|
262 | - 7 => 30, |
|
263 | - 8 => 30, |
|
264 | - 9 => 30, |
|
265 | - 10 => 30, |
|
266 | - 11 => 30, |
|
267 | - 12 => 29 ), |
|
257 | + 2 => 31, |
|
258 | + 3 => 31, |
|
259 | + 4 => 31, |
|
260 | + 5 => 31, |
|
261 | + 6 => 31, |
|
262 | + 7 => 30, |
|
263 | + 8 => 30, |
|
264 | + 9 => 30, |
|
265 | + 10 => 30, |
|
266 | + 11 => 30, |
|
267 | + 12 => 29 ), |
|
268 | 268 | |
269 | 269 | /************************************************************ |
270 | 270 | * Day of year |
@@ -345,9 +345,9 @@ discard block |
||
345 | 345 | */ |
346 | 346 | 'leap_year' => function ($year) { |
347 | 347 | |
348 | - $a = 0.025; |
|
348 | + $a = 0.025; |
|
349 | 349 | |
350 | - $b = 266; |
|
350 | + $b = 266; |
|
351 | 351 | |
352 | 352 | if ($year > 0) { |
353 | 353 | $leapDays0 = (($year + 38) % 2820)*0.24219 + $a; |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | |
364 | - $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
365 | - $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
364 | + $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
365 | + $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
366 | 366 | |
367 | 367 | if ($frac0 <= $b && $frac1 > $b) { |
368 | 368 | return true; |
@@ -382,4 +382,4 @@ discard block |
||
382 | 382 | */ |
383 | 383 | 'weekend' => array( 'friday' ) |
384 | 384 | |
385 | - ); |
|
385 | + ); |