@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | public static function loadClassLoader($class) |
10 | 10 | { |
11 | 11 | if ('Composer\Autoload\ClassLoader' === $class) { |
12 | - require __DIR__ . '/ClassLoader.php'; |
|
12 | + require __DIR__.'/ClassLoader.php'; |
|
13 | 13 | } |
14 | 14 | } |
15 | 15 | |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | self::$loader = $loader = new \Composer\Autoload\ClassLoader(); |
24 | 24 | spl_autoload_unregister(array('ComposerAutoloaderInitac8bf09341946841246f06f2975982e0', 'loadClassLoader')); |
25 | 25 | |
26 | - $map = require __DIR__ . '/autoload_namespaces.php'; |
|
26 | + $map = require __DIR__.'/autoload_namespaces.php'; |
|
27 | 27 | foreach ($map as $namespace => $path) { |
28 | 28 | $loader->set($namespace, $path); |
29 | 29 | } |
30 | 30 | |
31 | - $map = require __DIR__ . '/autoload_psr4.php'; |
|
31 | + $map = require __DIR__.'/autoload_psr4.php'; |
|
32 | 32 | foreach ($map as $namespace => $path) { |
33 | 33 | $loader->setPsr4($namespace, $path); |
34 | 34 | } |
35 | 35 | |
36 | - $classMap = require __DIR__ . '/autoload_classmap.php'; |
|
36 | + $classMap = require __DIR__.'/autoload_classmap.php'; |
|
37 | 37 | if ($classMap) { |
38 | 38 | $loader->addClassMap($classMap); |
39 | 39 | } |
@@ -6,6 +6,6 @@ |
||
6 | 6 | $baseDir = dirname($vendorDir); |
7 | 7 | |
8 | 8 | return array( |
9 | - 'Datium\\Tools\\' => array($baseDir . '/src'), |
|
10 | - 'Datium\\' => array($baseDir . '/src', $baseDir . '/src/Events'), |
|
9 | + 'Datium\\Tools\\' => array($baseDir.'/src'), |
|
10 | + 'Datium\\' => array($baseDir.'/src', $baseDir.'/src/Events'), |
|
11 | 11 | ); |
@@ -1,7 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | - use Datium\Datium as Datium; |
|
4 | - |
|
5 | 3 | return array ( |
6 | 4 | |
7 | 5 | /************************************************************ |
@@ -131,7 +131,9 @@ |
||
131 | 131 | |
132 | 132 | foreach( $config['month_days_number'] as $month => $value ) { |
133 | 133 | |
134 | - if ( $_month < $month ) $result += $value; |
|
134 | + if ( $_month < $month ) { |
|
135 | + $result += $value; |
|
136 | + } |
|
135 | 137 | |
136 | 138 | } |
137 | 139 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | ``<?php |
2 | 2 | |
3 | - use Datium\Datium as Datium; |
|
3 | + use Datium\Datium as Datium; |
|
4 | 4 | |
5 | - return array ( |
|
5 | + return array ( |
|
6 | 6 | |
7 | - /************************************************************ |
|
7 | + /************************************************************ |
|
8 | 8 | * Convert to |
9 | 9 | ************************************************************ |
10 | 10 | * |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | * |
13 | 13 | *\_________________________________________________________/ |
14 | 14 | */ |
15 | - 'convert_to' => function( $date_time ) { |
|
15 | + 'convert_to' => function( $date_time ) { |
|
16 | 16 | |
17 | - return null; |
|
17 | + return null; |
|
18 | 18 | |
19 | - }, |
|
19 | + }, |
|
20 | 20 | |
21 | - /************************************************************ |
|
21 | + /************************************************************ |
|
22 | 22 | * Convert From |
23 | 23 | ************************************************************ |
24 | 24 | * |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | * |
27 | 27 | *\_________________________________________________________/ |
28 | 28 | */ |
29 | - 'convert_from' => function( $date_time ) { |
|
29 | + 'convert_from' => function( $date_time ) { |
|
30 | 30 | |
31 | - return null; |
|
31 | + return null; |
|
32 | 32 | |
33 | - }, |
|
33 | + }, |
|
34 | 34 | |
35 | - /************************************************************ |
|
35 | + /************************************************************ |
|
36 | 36 | * Shorthand for jalali calendar |
37 | 37 | ************************************************************ |
38 | 38 | * |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | *\_________________________________________________________/ |
42 | 42 | */ |
43 | - 'shorthand' => 'gr', |
|
43 | + 'shorthand' => 'gr', |
|
44 | 44 | |
45 | - /************************************************************ |
|
45 | + /************************************************************ |
|
46 | 46 | * Month's name |
47 | 47 | ************************************************************ |
48 | 48 | * |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | |
77 | 77 | 'December' |
78 | 78 | |
79 | - ), |
|
79 | + ), |
|
80 | 80 | |
81 | - /************************************************************ |
|
81 | + /************************************************************ |
|
82 | 82 | * Days of Week |
83 | 83 | ************************************************************ |
84 | 84 | * |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * |
88 | 88 | *\_________________________________________________________/ |
89 | 89 | */ |
90 | - 'days_of_week' => array ( |
|
90 | + 'days_of_week' => array ( |
|
91 | 91 | 'Saturday', |
92 | 92 | 'Sunday', |
93 | 93 | 'Monday', |
@@ -96,53 +96,53 @@ discard block |
||
96 | 96 | 'Thursday', |
97 | 97 | 'Friday' |
98 | 98 | |
99 | - ), |
|
99 | + ), |
|
100 | 100 | |
101 | - 'month_days_number' => array( 1 => 31, |
|
102 | - 2 => 28, |
|
103 | - 3 => 31, |
|
104 | - 4 => 30, |
|
105 | - 5 => 31, |
|
106 | - 6 => 30, |
|
107 | - 7 => 31, |
|
108 | - 8 => 31, |
|
109 | - 9 => 30, |
|
110 | - 10 => 31, |
|
111 | - 11 => 30, |
|
112 | - 12 => 30 ), |
|
101 | + 'month_days_number' => array( 1 => 31, |
|
102 | + 2 => 28, |
|
103 | + 3 => 31, |
|
104 | + 4 => 30, |
|
105 | + 5 => 31, |
|
106 | + 6 => 30, |
|
107 | + 7 => 31, |
|
108 | + 8 => 31, |
|
109 | + 9 => 30, |
|
110 | + 10 => 31, |
|
111 | + 11 => 30, |
|
112 | + 12 => 30 ), |
|
113 | 113 | |
114 | 114 | |
115 | - 'day_of_year' => function( $date_time ) { |
|
115 | + 'day_of_year' => function( $date_time ) { |
|
116 | 116 | |
117 | - $result = null; |
|
117 | + $result = null; |
|
118 | 118 | |
119 | - $_month = null; |
|
119 | + $_month = null; |
|
120 | 120 | |
121 | - $config = include( 'Gregorian.php' ); |
|
121 | + $config = include( 'Gregorian.php' ); |
|
122 | 122 | |
123 | - $month = $date_time->format('n'); |
|
123 | + $month = $date_time->format('n'); |
|
124 | 124 | |
125 | - $day = $date_time->format('d'); |
|
125 | + $day = $date_time->format('d'); |
|
126 | 126 | |
127 | - foreach( $config['month_days_number'] as $_month => $value ) { |
|
127 | + foreach( $config['month_days_number'] as $_month => $value ) { |
|
128 | 128 | |
129 | - if ( $_month < $month ) $result += $value; |
|
129 | + if ( $_month < $month ) $result += $value; |
|
130 | 130 | |
131 | - } |
|
131 | + } |
|
132 | 132 | |
133 | - $result += $day; |
|
133 | + $result += $day; |
|
134 | 134 | |
135 | - return $result; |
|
135 | + return $result; |
|
136 | 136 | |
137 | - }, |
|
137 | + }, |
|
138 | 138 | |
139 | 139 | 'day_of_week' => function( $date_time ) { |
140 | 140 | |
141 | - return date( 'w', strtotime( $date_time->format('Y-m-d H:i:s') ) ); |
|
141 | + return date( 'w', strtotime( $date_time->format('Y-m-d H:i:s') ) ); |
|
142 | 142 | |
143 | - }, |
|
143 | + }, |
|
144 | 144 | |
145 | - /************************************************************ |
|
145 | + /************************************************************ |
|
146 | 146 | * Leap year |
147 | 147 | ************************************************************ |
148 | 148 | * |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * |
151 | 151 | *\_________________________________________________________/ |
152 | 152 | */ |
153 | - 'leap_year' => null, |
|
153 | + 'leap_year' => null, |
|
154 | 154 | |
155 | - /************************************************************ |
|
155 | + /************************************************************ |
|
156 | 156 | * Weekend |
157 | 157 | ************************************************************ |
158 | 158 | * |
@@ -160,6 +160,6 @@ discard block |
||
160 | 160 | * |
161 | 161 | *\_________________________________________________________/ |
162 | 162 | */ |
163 | - 'weekend' => array( 'friday' ) |
|
163 | + 'weekend' => array( 'friday' ) |
|
164 | 164 | |
165 | 165 | ); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Datium\Datium as Datium; |
4 | 4 | |
5 | - return array ( |
|
5 | + return array( |
|
6 | 6 | |
7 | 7 | /************************************************************ |
8 | 8 | * Convert to |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | *\_________________________________________________________/ |
14 | 14 | */ |
15 | - 'convert_to' => function( $date_time ) { |
|
15 | + 'convert_to' => function($date_time) { |
|
16 | 16 | |
17 | 17 | return null; |
18 | 18 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | *\_________________________________________________________/ |
28 | 28 | */ |
29 | - 'convert_from' => function( $date_time ) { |
|
29 | + 'convert_from' => function($date_time) { |
|
30 | 30 | |
31 | 31 | return null; |
32 | 32 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * |
88 | 88 | *\_________________________________________________________/ |
89 | 89 | */ |
90 | - 'days_of_week' => array ( |
|
90 | + 'days_of_week' => array( |
|
91 | 91 | 'Saturday', |
92 | 92 | 'Sunday', |
93 | 93 | 'Monday', |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | ), |
100 | 100 | |
101 | - 'month_days_number' => array( 1 => 31, |
|
101 | + 'month_days_number' => array(1 => 31, |
|
102 | 102 | 2 => 28, |
103 | 103 | 3 => 31, |
104 | 104 | 4 => 30, |
@@ -109,24 +109,24 @@ discard block |
||
109 | 109 | 9 => 30, |
110 | 110 | 10 => 31, |
111 | 111 | 11 => 30, |
112 | - 12 => 30 ), |
|
112 | + 12 => 30), |
|
113 | 113 | |
114 | 114 | |
115 | - 'day_of_year' => function( $date_time ) { |
|
115 | + 'day_of_year' => function($date_time) { |
|
116 | 116 | |
117 | 117 | $result = null; |
118 | 118 | |
119 | 119 | $_month = null; |
120 | 120 | |
121 | - $config = include( 'Gregorian.php' ); |
|
121 | + $config = include('Gregorian.php'); |
|
122 | 122 | |
123 | 123 | $month = $date_time->format('n'); |
124 | 124 | |
125 | 125 | $day = $date_time->format('d'); |
126 | 126 | |
127 | - foreach( $config['month_days_number'] as $_month => $value ) { |
|
127 | + foreach ($config['month_days_number'] as $_month => $value) { |
|
128 | 128 | |
129 | - if ( $_month < $month ) $result += $value; |
|
129 | + if ($_month < $month) $result += $value; |
|
130 | 130 | |
131 | 131 | } |
132 | 132 | |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | |
137 | 137 | }, |
138 | 138 | |
139 | - 'day_of_week' => function( $date_time ) { |
|
139 | + 'day_of_week' => function($date_time) { |
|
140 | 140 | |
141 | - return date( 'w', strtotime( $date_time->format('Y-m-d H:i:s') ) ); |
|
141 | + return date('w', strtotime($date_time->format('Y-m-d H:i:s'))); |
|
142 | 142 | |
143 | 143 | }, |
144 | 144 | |
@@ -160,6 +160,6 @@ discard block |
||
160 | 160 | * |
161 | 161 | *\_________________________________________________________/ |
162 | 162 | */ |
163 | - 'weekend' => array( 'friday' ) |
|
163 | + 'weekend' => array('friday') |
|
164 | 164 | |
165 | 165 | ); |
@@ -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 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - return array ( |
|
3 | + return array ( |
|
4 | 4 | |
5 | - /************************************************************ |
|
5 | + /************************************************************ |
|
6 | 6 | * Convert to |
7 | 7 | ************************************************************ |
8 | 8 | * |
@@ -10,85 +10,85 @@ discard block |
||
10 | 10 | * |
11 | 11 | *\_________________________________________________________/ |
12 | 12 | */ |
13 | - 'convert_to' => function( $date_time ) { |
|
13 | + 'convert_to' => function( $date_time ) { |
|
14 | 14 | |
15 | - $config = include( 'Shamsi.php' ); |
|
15 | + $config = include( 'Shamsi.php' ); |
|
16 | 16 | |
17 | - $date_time = Datium\Datium::create( $date_time )->to( 'shamsi' )->object(); |
|
17 | + $date_time = Datium\Datium::create( $date_time )->to( 'shamsi' )->object(); |
|
18 | 18 | |
19 | - $year = $date_time->format('Y'); |
|
19 | + $year = $date_time->format('Y'); |
|
20 | 20 | |
21 | - $month = $date_time->format('n'); |
|
21 | + $month = $date_time->format('n'); |
|
22 | 22 | |
23 | - $day = $date_time->format('d'); |
|
23 | + $day = $date_time->format('d'); |
|
24 | 24 | |
25 | - $temp_day = 0 ; |
|
25 | + $temp_day = 0 ; |
|
26 | 26 | |
27 | - for ( $i = 1 ; $i < $month ; $i++ ) { |
|
27 | + for ( $i = 1 ; $i < $month ; $i++ ) { |
|
28 | 28 | |
29 | - $temp_day += $config[ 'month_days_number' ][ $i ]; |
|
29 | + $temp_day += $config[ 'month_days_number' ][ $i ]; |
|
30 | 30 | |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | 33 | $temp_day += $day; |
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 ) $temp_day++; |
|
38 | 38 | |
39 | - $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
39 | + $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
40 | 40 | |
41 | - $_year = explode( '.', $_year ); |
|
41 | + $_year = explode( '.', $_year ); |
|
42 | 42 | |
43 | - $year = $_year[0]; |
|
43 | + $year = $_year[0]; |
|
44 | 44 | |
45 | - $_month = $_year[1]; |
|
45 | + $_month = $_year[1]; |
|
46 | 46 | |
47 | 47 | $var_temp = '0.0'; |
48 | 48 | |
49 | - for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
|
49 | + for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
|
50 | 50 | |
51 | - $var_temp .= '0'; |
|
51 | + $var_temp .= '0'; |
|
52 | 52 | |
53 | 53 | } |
54 | 54 | |
55 | 55 | $var_temp .= '1'; |
56 | 56 | |
57 | - $_month = $_month * $var_temp ; |
|
57 | + $_month = $_month * $var_temp ; |
|
58 | 58 | |
59 | - $_month = ( $_month * 12 ) + 1; |
|
59 | + $_month = ( $_month * 12 ) + 1; |
|
60 | 60 | |
61 | - $_month = explode( '.', $_month ); |
|
61 | + $_month = explode( '.', $_month ); |
|
62 | 62 | |
63 | - $month = $_month[0]; |
|
63 | + $month = $_month[0]; |
|
64 | 64 | |
65 | - $_day = $_month[1]; |
|
65 | + $_day = $_month[1]; |
|
66 | 66 | |
67 | - $var_temp = '0.0'; |
|
67 | + $var_temp = '0.0'; |
|
68 | 68 | |
69 | - for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
|
69 | + for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
|
70 | 70 | |
71 | 71 | $var_temp .= '0' ; |
72 | 72 | |
73 | - } |
|
73 | + } |
|
74 | 74 | |
75 | - $var_temp .= '1'; |
|
75 | + $var_temp .= '1'; |
|
76 | 76 | |
77 | - $_day = $_day * $var_temp; |
|
77 | + $_day = $_day * $var_temp; |
|
78 | 78 | |
79 | - $_day = ( $_day * 29.530 ); |
|
79 | + $_day = ( $_day * 29.530 ); |
|
80 | 80 | |
81 | - $_day = explode( '.', $_day ); |
|
81 | + $_day = explode( '.', $_day ); |
|
82 | 82 | |
83 | - $day = $_day[0]; |
|
83 | + $day = $_day[0]; |
|
84 | 84 | |
85 | 85 | $date_time->setDate( $year, $month, $day ); |
86 | 86 | |
87 | 87 | return $date_time; |
88 | 88 | |
89 | - }, |
|
89 | + }, |
|
90 | 90 | |
91 | - /************************************************************ |
|
91 | + /************************************************************ |
|
92 | 92 | * Convert From |
93 | 93 | ************************************************************ |
94 | 94 | * |
@@ -96,62 +96,62 @@ discard block |
||
96 | 96 | * |
97 | 97 | *\_________________________________________________________/ |
98 | 98 | */ |
99 | - 'convert_from' => function( $date_time ) { |
|
99 | + 'convert_from' => function( $date_time ) { |
|
100 | 100 | |
101 | - $config = include('Ghamari.php'); |
|
101 | + $config = include('Ghamari.php'); |
|
102 | 102 | |
103 | - $year = $date_time->format('Y'); |
|
103 | + $year = $date_time->format('Y'); |
|
104 | 104 | |
105 | - $month = $date_time->format('m'); |
|
105 | + $month = $date_time->format('m'); |
|
106 | 106 | |
107 | - $day = $date_time->format('d'); |
|
107 | + $day = $date_time->format('d'); |
|
108 | 108 | |
109 | - $days_of_year = 0; |
|
109 | + $days_of_year = 0; |
|
110 | 110 | |
111 | - foreach ( $config['month_days_number'] as $month => $value ) { |
|
111 | + foreach ( $config['month_days_number'] as $month => $value ) { |
|
112 | 112 | |
113 | - if( $month > $month ) $days_of_year += $value; |
|
113 | + if( $month > $month ) $days_of_year += $value; |
|
114 | 114 | |
115 | - } |
|
115 | + } |
|
116 | 116 | |
117 | - $days_of_year += $day; |
|
117 | + $days_of_year += $day; |
|
118 | 118 | |
119 | - $days_of_leap_years = intval( ( ( $year - 1 ) / 3 ) ); |
|
119 | + $days_of_leap_years = intval( ( ( $year - 1 ) / 3 ) ); |
|
120 | 120 | |
121 | - $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
121 | + $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
122 | 122 | |
123 | - $days_of_gregorain_years = $days_of_ghamari_years + 227078; |
|
123 | + $days_of_gregorain_years = $days_of_ghamari_years + 227078; |
|
124 | 124 | |
125 | - $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 578 ) / 4 ) ); |
|
125 | + $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 578 ) / 4 ) ); |
|
126 | 126 | |
127 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
127 | + $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
128 | 128 | |
129 | - $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1; |
|
129 | + $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1; |
|
130 | 130 | |
131 | - $config = include('Gregorian.php'); |
|
131 | + $config = include('Gregorian.php'); |
|
132 | 132 | |
133 | - foreach ($config [ 'month_days_number' ] as $month => $value) { |
|
133 | + foreach ($config [ 'month_days_number' ] as $month => $value) { |
|
134 | 134 | |
135 | - if ( $gregorian_month < $value ) { |
|
135 | + if ( $gregorian_month < $value ) { |
|
136 | 136 | |
137 | - break; |
|
138 | - } |
|
137 | + break; |
|
138 | + } |
|
139 | 139 | |
140 | - $gregorian_month -= $value; |
|
141 | - } |
|
140 | + $gregorian_month -= $value; |
|
141 | + } |
|
142 | 142 | |
143 | - $gregorian_day = $gregorian_month; |
|
143 | + $gregorian_day = $gregorian_month; |
|
144 | 144 | |
145 | - $gregorian_month = $month; |
|
145 | + $gregorian_month = $month; |
|
146 | 146 | |
147 | - $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
|
147 | + $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
|
148 | 148 | |
149 | 149 | return $date_time; |
150 | 150 | |
151 | 151 | |
152 | - }, |
|
152 | + }, |
|
153 | 153 | |
154 | - /************************************************************ |
|
154 | + /************************************************************ |
|
155 | 155 | * Shorthand for jalali calendar |
156 | 156 | ************************************************************ |
157 | 157 | * |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * |
160 | 160 | *\_________________________________________________________/ |
161 | 161 | */ |
162 | - 'shorthand' => 'sh', |
|
162 | + 'shorthand' => 'sh', |
|
163 | 163 | |
164 | - /************************************************************ |
|
164 | + /************************************************************ |
|
165 | 165 | * Month's name |
166 | 166 | ************************************************************ |
167 | 167 | * |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * |
170 | 170 | *\_________________________________________________________/ |
171 | 171 | */ |
172 | - 'month' => array ( |
|
172 | + 'month' => array ( |
|
173 | 173 | |
174 | 174 | 'Muharram', |
175 | 175 | |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | |
196 | 196 | 'Dhu al_Hijjah' |
197 | 197 | |
198 | - ), |
|
198 | + ), |
|
199 | 199 | |
200 | - /************************************************************ |
|
200 | + /************************************************************ |
|
201 | 201 | * Days of Week |
202 | 202 | ************************************************************ |
203 | 203 | * |
@@ -206,79 +206,79 @@ discard block |
||
206 | 206 | * |
207 | 207 | *\_________________________________________________________/ |
208 | 208 | */ |
209 | - 'days_of_week' => array ( |
|
210 | - 'al-Aḥad', |
|
211 | - 'al-Ithnayn', |
|
212 | - 'ath-Thulatha\'', |
|
213 | - 'al-Arbi\'a', |
|
214 | - 'al-Khamees', |
|
215 | - 'al-Jumu\'ah', |
|
216 | - 'as-Sabt', |
|
209 | + 'days_of_week' => array ( |
|
210 | + 'al-Aḥad', |
|
211 | + 'al-Ithnayn', |
|
212 | + 'ath-Thulatha\'', |
|
213 | + 'al-Arbi\'a', |
|
214 | + 'al-Khamees', |
|
215 | + 'al-Jumu\'ah', |
|
216 | + 'as-Sabt', |
|
217 | 217 | |
218 | - ), |
|
218 | + ), |
|
219 | 219 | |
220 | - 'month_days_number' => array( 1 => 30, |
|
221 | - 2 => 29, |
|
222 | - 3 => 30, |
|
223 | - 4 => 30, |
|
224 | - 5 => 29, |
|
225 | - 6 => 29, |
|
226 | - 7 => 30, |
|
227 | - 8 => 29, |
|
228 | - 9 => 30, |
|
229 | - 10 => 29, |
|
230 | - 11 => 30, |
|
231 | - 12 => 30 ), |
|
220 | + 'month_days_number' => array( 1 => 30, |
|
221 | + 2 => 29, |
|
222 | + 3 => 30, |
|
223 | + 4 => 30, |
|
224 | + 5 => 29, |
|
225 | + 6 => 29, |
|
226 | + 7 => 30, |
|
227 | + 8 => 29, |
|
228 | + 9 => 30, |
|
229 | + 10 => 29, |
|
230 | + 11 => 30, |
|
231 | + 12 => 30 ), |
|
232 | 232 | |
233 | - 'day_of_year' => function( $date_time ) { |
|
233 | + 'day_of_year' => function( $date_time ) { |
|
234 | 234 | |
235 | - $result = null; |
|
235 | + $result = null; |
|
236 | 236 | |
237 | - $config = include( 'Ghamari.php' ); |
|
237 | + $config = include( 'Ghamari.php' ); |
|
238 | 238 | |
239 | - $month = $date_time->format('n'); |
|
239 | + $month = $date_time->format('n'); |
|
240 | 240 | |
241 | - $day = $date_time->format('d'); |
|
241 | + $day = $date_time->format('d'); |
|
242 | 242 | |
243 | - foreach( $config['month_days_number'] as $_month => $value ) { |
|
243 | + foreach( $config['month_days_number'] as $_month => $value ) { |
|
244 | 244 | |
245 | - if ( $_month < $month ) { |
|
245 | + if ( $_month < $month ) { |
|
246 | 246 | |
247 | - $result += $value; |
|
247 | + $result += $value; |
|
248 | 248 | |
249 | - } |
|
249 | + } |
|
250 | 250 | |
251 | - } |
|
251 | + } |
|
252 | 252 | |
253 | - $result += $day; |
|
253 | + $result += $day; |
|
254 | 254 | |
255 | - return $result + 1; |
|
255 | + return $result + 1; |
|
256 | 256 | |
257 | - }, |
|
257 | + }, |
|
258 | 258 | |
259 | - 'day_of_week' => function( $date_time ) { |
|
259 | + 'day_of_week' => function( $date_time ) { |
|
260 | 260 | |
261 | - $configGhamari = include( 'Ghamari.php' ); |
|
261 | + $configGhamari = include( 'Ghamari.php' ); |
|
262 | 262 | |
263 | - $configGregorian = include( 'Gregorian.php' ); |
|
263 | + $configGregorian = include( 'Gregorian.php' ); |
|
264 | 264 | |
265 | - $day = $date_time->format('l'); |
|
265 | + $day = $date_time->format('l'); |
|
266 | 266 | |
267 | - $day = str_replace( $configGregorian['days_of_week'], $configGhamari['days_of_week'], $day); |
|
267 | + $day = str_replace( $configGregorian['days_of_week'], $configGhamari['days_of_week'], $day); |
|
268 | 268 | |
269 | - foreach ( $configGhamari['days_of_week'] as $key => $value ) { |
|
269 | + foreach ( $configGhamari['days_of_week'] as $key => $value ) { |
|
270 | 270 | |
271 | - if( $value == $day ) { |
|
271 | + if( $value == $day ) { |
|
272 | 272 | |
273 | - return $key += 1; |
|
273 | + return $key += 1; |
|
274 | 274 | |
275 | - } |
|
275 | + } |
|
276 | 276 | |
277 | - } |
|
277 | + } |
|
278 | 278 | |
279 | - }, |
|
279 | + }, |
|
280 | 280 | |
281 | - /************************************************************ |
|
281 | + /************************************************************ |
|
282 | 282 | * Leap year |
283 | 283 | ************************************************************ |
284 | 284 | * |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | * |
287 | 287 | *\_________________________________________________________/ |
288 | 288 | */ |
289 | - 'leap_year' => null, |
|
289 | + 'leap_year' => null, |
|
290 | 290 | |
291 | - /************************************************************ |
|
291 | + /************************************************************ |
|
292 | 292 | * Weekend |
293 | 293 | ************************************************************ |
294 | 294 | * |
@@ -296,6 +296,6 @@ discard block |
||
296 | 296 | * |
297 | 297 | *\_________________________________________________________/ |
298 | 298 | */ |
299 | - 'weekend' => array( 'friday' ) |
|
299 | + 'weekend' => array( 'friday' ) |
|
300 | 300 | |
301 | 301 | ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - return array ( |
|
3 | + return array( |
|
4 | 4 | |
5 | 5 | /************************************************************ |
6 | 6 | * Convert to |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | * |
11 | 11 | *\_________________________________________________________/ |
12 | 12 | */ |
13 | - 'convert_to' => function( $date_time ) { |
|
13 | + 'convert_to' => function($date_time) { |
|
14 | 14 | |
15 | - $config = include( 'Shamsi.php' ); |
|
15 | + $config = include('Shamsi.php'); |
|
16 | 16 | |
17 | - $date_time = Datium\Datium::create( $date_time )->to( 'shamsi' )->object(); |
|
17 | + $date_time = Datium\Datium::create($date_time)->to('shamsi')->object(); |
|
18 | 18 | |
19 | 19 | $year = $date_time->format('Y'); |
20 | 20 | |
@@ -22,23 +22,23 @@ discard block |
||
22 | 22 | |
23 | 23 | $day = $date_time->format('d'); |
24 | 24 | |
25 | - $temp_day = 0 ; |
|
25 | + $temp_day = 0; |
|
26 | 26 | |
27 | - for ( $i = 1 ; $i < $month ; $i++ ) { |
|
27 | + for ($i = 1; $i < $month; $i++) { |
|
28 | 28 | |
29 | - $temp_day += $config[ 'month_days_number' ][ $i ]; |
|
29 | + $temp_day += $config['month_days_number'][$i]; |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | |
33 | 33 | $temp_day += $day; |
34 | 34 | |
35 | - $leap = new Datium\Tools\Leap( $year ); |
|
35 | + $leap = new Datium\Tools\Leap($year); |
|
36 | 36 | |
37 | - if( $leap->get() && $month > 11 ) $temp_day++; |
|
37 | + if ($leap->get() && $month > 11) $temp_day++; |
|
38 | 38 | |
39 | - $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
39 | + $_year = ((((($year - 1) * 365.2422) + $temp_day) - 119) / 354.3670) + 1; |
|
40 | 40 | |
41 | - $_year = explode( '.', $_year ); |
|
41 | + $_year = explode('.', $_year); |
|
42 | 42 | |
43 | 43 | $year = $_year[0]; |
44 | 44 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | $var_temp = '0.0'; |
48 | 48 | |
49 | - for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
|
49 | + for ($i = strlen($_month); $i > 2; $i--) { |
|
50 | 50 | |
51 | 51 | $var_temp .= '0'; |
52 | 52 | |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | |
55 | 55 | $var_temp .= '1'; |
56 | 56 | |
57 | - $_month = $_month * $var_temp ; |
|
57 | + $_month = $_month * $var_temp; |
|
58 | 58 | |
59 | - $_month = ( $_month * 12 ) + 1; |
|
59 | + $_month = ($_month * 12) + 1; |
|
60 | 60 | |
61 | - $_month = explode( '.', $_month ); |
|
61 | + $_month = explode('.', $_month); |
|
62 | 62 | |
63 | 63 | $month = $_month[0]; |
64 | 64 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | |
67 | 67 | $var_temp = '0.0'; |
68 | 68 | |
69 | - for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
|
69 | + for ($i = strlen($_day); $i > 2; $i--) { |
|
70 | 70 | |
71 | - $var_temp .= '0' ; |
|
71 | + $var_temp .= '0'; |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | |
77 | 77 | $_day = $_day * $var_temp; |
78 | 78 | |
79 | - $_day = ( $_day * 29.530 ); |
|
79 | + $_day = ($_day * 29.530); |
|
80 | 80 | |
81 | - $_day = explode( '.', $_day ); |
|
81 | + $_day = explode('.', $_day); |
|
82 | 82 | |
83 | 83 | $day = $_day[0]; |
84 | 84 | |
85 | - $date_time->setDate( $year, $month, $day ); |
|
85 | + $date_time->setDate($year, $month, $day); |
|
86 | 86 | |
87 | 87 | return $date_time; |
88 | 88 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | *\_________________________________________________________/ |
98 | 98 | */ |
99 | - 'convert_from' => function( $date_time ) { |
|
99 | + 'convert_from' => function($date_time) { |
|
100 | 100 | |
101 | 101 | $config = include('Ghamari.php'); |
102 | 102 | |
@@ -108,31 +108,31 @@ discard block |
||
108 | 108 | |
109 | 109 | $days_of_year = 0; |
110 | 110 | |
111 | - foreach ( $config['month_days_number'] as $month => $value ) { |
|
111 | + foreach ($config['month_days_number'] as $month => $value) { |
|
112 | 112 | |
113 | - if( $month > $month ) $days_of_year += $value; |
|
113 | + if ($month > $month) $days_of_year += $value; |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | 117 | $days_of_year += $day; |
118 | 118 | |
119 | - $days_of_leap_years = intval( ( ( $year - 1 ) / 3 ) ); |
|
119 | + $days_of_leap_years = intval((($year - 1) / 3)); |
|
120 | 120 | |
121 | - $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
121 | + $days_of_ghamari_years = ((($year - 1) * 354) + $days_of_year + $days_of_leap_years); |
|
122 | 122 | |
123 | 123 | $days_of_gregorain_years = $days_of_ghamari_years + 227078; |
124 | 124 | |
125 | - $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 578 ) / 4 ) ); |
|
125 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 578) / 4)); |
|
126 | 126 | |
127 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
127 | + $gregorian_month = ($days_of_gregorain_years % 365); |
|
128 | 128 | |
129 | - $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1; |
|
129 | + $gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
|
130 | 130 | |
131 | 131 | $config = include('Gregorian.php'); |
132 | 132 | |
133 | - foreach ($config [ 'month_days_number' ] as $month => $value) { |
|
133 | + foreach ($config ['month_days_number'] as $month => $value) { |
|
134 | 134 | |
135 | - if ( $gregorian_month < $value ) { |
|
135 | + if ($gregorian_month < $value) { |
|
136 | 136 | |
137 | 137 | break; |
138 | 138 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $gregorian_month = $month; |
146 | 146 | |
147 | - $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
|
147 | + $date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
|
148 | 148 | |
149 | 149 | return $date_time; |
150 | 150 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * |
170 | 170 | *\_________________________________________________________/ |
171 | 171 | */ |
172 | - 'month' => array ( |
|
172 | + 'month' => array( |
|
173 | 173 | |
174 | 174 | 'Muharram', |
175 | 175 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * |
207 | 207 | *\_________________________________________________________/ |
208 | 208 | */ |
209 | - 'days_of_week' => array ( |
|
209 | + 'days_of_week' => array( |
|
210 | 210 | 'al-Aḥad', |
211 | 211 | 'al-Ithnayn', |
212 | 212 | 'ath-Thulatha\'', |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | ), |
219 | 219 | |
220 | - 'month_days_number' => array( 1 => 30, |
|
220 | + 'month_days_number' => array(1 => 30, |
|
221 | 221 | 2 => 29, |
222 | 222 | 3 => 30, |
223 | 223 | 4 => 30, |
@@ -228,21 +228,21 @@ discard block |
||
228 | 228 | 9 => 30, |
229 | 229 | 10 => 29, |
230 | 230 | 11 => 30, |
231 | - 12 => 30 ), |
|
231 | + 12 => 30), |
|
232 | 232 | |
233 | - 'day_of_year' => function( $date_time ) { |
|
233 | + 'day_of_year' => function($date_time) { |
|
234 | 234 | |
235 | 235 | $result = null; |
236 | 236 | |
237 | - $config = include( 'Ghamari.php' ); |
|
237 | + $config = include('Ghamari.php'); |
|
238 | 238 | |
239 | 239 | $month = $date_time->format('n'); |
240 | 240 | |
241 | 241 | $day = $date_time->format('d'); |
242 | 242 | |
243 | - foreach( $config['month_days_number'] as $_month => $value ) { |
|
243 | + foreach ($config['month_days_number'] as $_month => $value) { |
|
244 | 244 | |
245 | - if ( $_month < $month ) { |
|
245 | + if ($_month < $month) { |
|
246 | 246 | |
247 | 247 | $result += $value; |
248 | 248 | |
@@ -256,19 +256,19 @@ discard block |
||
256 | 256 | |
257 | 257 | }, |
258 | 258 | |
259 | - 'day_of_week' => function( $date_time ) { |
|
259 | + 'day_of_week' => function($date_time) { |
|
260 | 260 | |
261 | - $configGhamari = include( 'Ghamari.php' ); |
|
261 | + $configGhamari = include('Ghamari.php'); |
|
262 | 262 | |
263 | - $configGregorian = include( 'Gregorian.php' ); |
|
263 | + $configGregorian = include('Gregorian.php'); |
|
264 | 264 | |
265 | 265 | $day = $date_time->format('l'); |
266 | 266 | |
267 | - $day = str_replace( $configGregorian['days_of_week'], $configGhamari['days_of_week'], $day); |
|
267 | + $day = str_replace($configGregorian['days_of_week'], $configGhamari['days_of_week'], $day); |
|
268 | 268 | |
269 | - foreach ( $configGhamari['days_of_week'] as $key => $value ) { |
|
269 | + foreach ($configGhamari['days_of_week'] as $key => $value) { |
|
270 | 270 | |
271 | - if( $value == $day ) { |
|
271 | + if ($value == $day) { |
|
272 | 272 | |
273 | 273 | return $key += 1; |
274 | 274 | |
@@ -296,6 +296,6 @@ discard block |
||
296 | 296 | * |
297 | 297 | *\_________________________________________________________/ |
298 | 298 | */ |
299 | - 'weekend' => array( 'friday' ) |
|
299 | + 'weekend' => array('friday') |
|
300 | 300 | |
301 | 301 | ); |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | ), |
107 | 107 | |
108 | 108 | 'month_days_number' => array( 1 => 31, |
109 | - 2 => 31, |
|
110 | - 3 => 31, |
|
111 | - 4 => 31, |
|
112 | - 5 => 31, |
|
113 | - 6 => 31, |
|
114 | - 7 => 30, |
|
115 | - 8 => 30, |
|
116 | - 9 => 30, |
|
117 | - 10 => 30, |
|
118 | - 11 => 30, |
|
119 | - 12 => 29 ), |
|
109 | + 2 => 31, |
|
110 | + 3 => 31, |
|
111 | + 4 => 31, |
|
112 | + 5 => 31, |
|
113 | + 6 => 31, |
|
114 | + 7 => 30, |
|
115 | + 8 => 30, |
|
116 | + 9 => 30, |
|
117 | + 10 => 30, |
|
118 | + 11 => 30, |
|
119 | + 12 => 29 ), |
|
120 | 120 | |
121 | 121 | /************************************************************ |
122 | 122 | * Leap year |
@@ -138,4 +138,4 @@ discard block |
||
138 | 138 | */ |
139 | 139 | 'weekend' => array( 'friday' ) |
140 | 140 | |
141 | - ); |
|
141 | + ); |
@@ -131,7 +131,9 @@ |
||
131 | 131 | |
132 | 132 | foreach( $config['month_days_number'] as $_month => $value ) { |
133 | 133 | |
134 | - if ( $_month < $month ) $result += $value; |
|
134 | + if ( $_month < $month ) { |
|
135 | + $result += $value; |
|
136 | + } |
|
135 | 137 | |
136 | 138 | } |
137 | 139 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Datium\Datium as Datium; |
4 | 4 | |
5 | -return array ( |
|
5 | +return array( |
|
6 | 6 | |
7 | 7 | /************************************************************ |
8 | 8 | * Convert to |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | * |
13 | 13 | *\_________________________________________________________/ |
14 | 14 | */ |
15 | - 'convert_to' => function( $date_time ) { |
|
15 | + 'convert_to' => function($date_time) { |
|
16 | 16 | |
17 | - return Datium::create( $date_time )->sub( '226898 day' )->object(); |
|
17 | + return Datium::create($date_time)->sub('226898 day')->object(); |
|
18 | 18 | |
19 | 19 | }, |
20 | 20 | |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * |
27 | 27 | *\_________________________________________________________/ |
28 | 28 | */ |
29 | - 'convert_from' => function( $date_time ) { |
|
29 | + 'convert_from' => function($date_time) { |
|
30 | 30 | |
31 | - return Datium::create( $date_time )->add( '226898 day' )->object(); |
|
31 | + return Datium::create($date_time)->add('226898 day')->object(); |
|
32 | 32 | |
33 | 33 | }, |
34 | 34 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | *\_________________________________________________________/ |
52 | 52 | */ |
53 | - 'month' => array ( |
|
53 | + 'month' => array( |
|
54 | 54 | |
55 | 55 | 'Farvardin', |
56 | 56 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * |
88 | 88 | *\_________________________________________________________/ |
89 | 89 | */ |
90 | - 'days_of_week' => array ( |
|
90 | + 'days_of_week' => array( |
|
91 | 91 | 'Yekshanbe', |
92 | 92 | 'Doshanbe', |
93 | 93 | 'Seshanbe', |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | 'start_day_of_week' => 'Shanbe', |
101 | 101 | |
102 | - 'month_days_number' => array( 1 => 31, |
|
102 | + 'month_days_number' => array(1 => 31, |
|
103 | 103 | 2 => 31, |
104 | 104 | 3 => 31, |
105 | 105 | 4 => 31, |
@@ -110,22 +110,22 @@ discard block |
||
110 | 110 | 9 => 30, |
111 | 111 | 10 => 30, |
112 | 112 | 11 => 30, |
113 | - 12 => 29 ), |
|
113 | + 12 => 29), |
|
114 | 114 | |
115 | 115 | |
116 | - 'day_of_year' => function( $date_time ) { |
|
116 | + 'day_of_year' => function($date_time) { |
|
117 | 117 | |
118 | 118 | $result = null; |
119 | 119 | |
120 | - $config = include( 'Shamsi.php' ); |
|
120 | + $config = include('Shamsi.php'); |
|
121 | 121 | |
122 | 122 | $month = $date_time->format('n'); |
123 | 123 | |
124 | 124 | $day = $date_time->format('d'); |
125 | 125 | |
126 | - foreach( $config['month_days_number'] as $_month => $value ) { |
|
126 | + foreach ($config['month_days_number'] as $_month => $value) { |
|
127 | 127 | |
128 | - if ( $_month < $month ) $result += $value; |
|
128 | + if ($_month < $month) $result += $value; |
|
129 | 129 | |
130 | 130 | } |
131 | 131 | |
@@ -135,19 +135,19 @@ discard block |
||
135 | 135 | |
136 | 136 | }, |
137 | 137 | |
138 | - 'day_of_week' => function( $date_time ) { |
|
138 | + 'day_of_week' => function($date_time) { |
|
139 | 139 | |
140 | - $configShamsi = include( 'Shamsi.php' ); |
|
140 | + $configShamsi = include('Shamsi.php'); |
|
141 | 141 | |
142 | - $configGregorian = include( 'Gregorian.php' ); |
|
142 | + $configGregorian = include('Gregorian.php'); |
|
143 | 143 | |
144 | 144 | $day = $date_time->format('l'); |
145 | 145 | |
146 | - $day = str_replace( $configGregorian['days_of_week'], $configShamsi['days_of_week'], $day ); |
|
146 | + $day = str_replace($configGregorian['days_of_week'], $configShamsi['days_of_week'], $day); |
|
147 | 147 | |
148 | - foreach ( $configShamsi['days_of_week'] as $key => $value ) { |
|
148 | + foreach ($configShamsi['days_of_week'] as $key => $value) { |
|
149 | 149 | |
150 | - if( $value == $day ) { |
|
150 | + if ($value == $day) { |
|
151 | 151 | |
152 | 152 | return $key += 1; |
153 | 153 | |
@@ -177,6 +177,6 @@ discard block |
||
177 | 177 | * |
178 | 178 | *\_________________________________________________________/ |
179 | 179 | */ |
180 | - 'weekend' => array( 'friday' ) |
|
180 | + 'weekend' => array('friday') |
|
181 | 181 | |
182 | 182 | ); |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Datium\Tools\Convert; |
6 | 6 | use Datium\Tools\Leap; |
7 | 7 | use Datium\Tools\DayOf; |
8 | -use Datium\Tools\Translate; |
|
9 | 8 | |
10 | 9 | /** |
11 | 10 | * |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | /** |
139 | 139 | * Get current datetime |
140 | 140 | * @since Aug 17 2015 |
141 | - * @return object |
|
141 | + * @return Datium |
|
142 | 142 | */ |
143 | 143 | public static function now() { |
144 | 144 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param $hour integer |
157 | 157 | * @param $minute integer |
158 | 158 | * @param $second integer |
159 | - * @return object |
|
159 | + * @return Datium |
|
160 | 160 | */ |
161 | 161 | public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) { |
162 | 162 | |
@@ -195,6 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Convert from current calendar, what type is current calendar? |
198 | + * @param string $calendar |
|
198 | 199 | */ |
199 | 200 | public function from( $calendar ) { |
200 | 201 | |
@@ -213,6 +214,9 @@ discard block |
||
213 | 214 | |
214 | 215 | } |
215 | 216 | |
217 | + /** |
|
218 | + * @param string $calendar |
|
219 | + */ |
|
216 | 220 | public function to( $calendar ) { |
217 | 221 | |
218 | 222 | $this->convert = new Convert( $this->date_time ); |
@@ -245,7 +249,7 @@ discard block |
||
245 | 249 | /** |
246 | 250 | * Add new date value to current date |
247 | 251 | * @param $value string |
248 | - * @return object |
|
252 | + * @return Datium |
|
249 | 253 | */ |
250 | 254 | public function add( $value ) { |
251 | 255 | |
@@ -262,7 +266,7 @@ discard block |
||
262 | 266 | /** |
263 | 267 | * Sub date from current date |
264 | 268 | * @param $value |
265 | - * @return obejct |
|
269 | + * @return Datium |
|
266 | 270 | */ |
267 | 271 | public function sub( $value ) { |
268 | 272 | |
@@ -278,7 +282,7 @@ discard block |
||
278 | 282 | |
279 | 283 | /** |
280 | 284 | * Check if current year is leap or not |
281 | - * @return boolean |
|
285 | + * @return Leap |
|
282 | 286 | */ |
283 | 287 | public function leap( $type = 'gregorian') { |
284 | 288 |
@@ -68,17 +68,17 @@ discard block |
||
68 | 68 | |
69 | 69 | $this->config = include('Config.php'); |
70 | 70 | |
71 | - $this->calendar_type = $this->config[ 'default_calendar' ]; |
|
71 | + $this->calendar_type = $this->config['default_calendar']; |
|
72 | 72 | |
73 | - date_default_timezone_set( $this->config['timezone'] ); |
|
73 | + date_default_timezone_set($this->config['timezone']); |
|
74 | 74 | |
75 | 75 | $this->calendar_type = 'gregorian'; |
76 | 76 | |
77 | - switch( Datium::$call_type ) { |
|
77 | + switch (Datium::$call_type) { |
|
78 | 78 | |
79 | 79 | case 'now': |
80 | 80 | |
81 | - $this->date_time = new DateTime( 'now' ); |
|
81 | + $this->date_time = new DateTime('now'); |
|
82 | 82 | |
83 | 83 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
84 | 84 | |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | |
87 | 87 | case 'make': |
88 | 88 | |
89 | - $this->date_time = new DateTime( 'now' ); |
|
89 | + $this->date_time = new DateTime('now'); |
|
90 | 90 | |
91 | - $this->date_time->setDate( self::$array_date['year'], self::$array_date['month'], self::$array_date['day'] ); |
|
91 | + $this->date_time->setDate(self::$array_date['year'], self::$array_date['month'], self::$array_date['day']); |
|
92 | 92 | |
93 | - $this->date_time->setTime( self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second'] ); |
|
93 | + $this->date_time->setTime(self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second']); |
|
94 | 94 | |
95 | 95 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
96 | 96 | |
@@ -119,17 +119,17 @@ discard block |
||
119 | 119 | |
120 | 120 | return (object) array( |
121 | 121 | |
122 | - 'second' => $this->date_time->format( 's' ), |
|
122 | + 'second' => $this->date_time->format('s'), |
|
123 | 123 | |
124 | - 'minute' => $this->date_time->format( 'm' ), |
|
124 | + 'minute' => $this->date_time->format('m'), |
|
125 | 125 | |
126 | - 'hour' => $this->date_time->format( 'H' ), |
|
126 | + 'hour' => $this->date_time->format('H'), |
|
127 | 127 | |
128 | - 'day' => $this->date_time->format( 'd' ), |
|
128 | + 'day' => $this->date_time->format('d'), |
|
129 | 129 | |
130 | - 'month' => $this->date_time->format( 'm' ), |
|
130 | + 'month' => $this->date_time->format('m'), |
|
131 | 131 | |
132 | - 'year' => $this->date_time->format( 'Y' ) |
|
132 | + 'year' => $this->date_time->format('Y') |
|
133 | 133 | |
134 | 134 | ); |
135 | 135 | |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | * @param $second integer |
159 | 159 | * @return object |
160 | 160 | */ |
161 | - public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) { |
|
161 | + public static function create($year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) { |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * When we want to set a Datetime object to Datium |
165 | 165 | */ |
166 | - if( func_num_args() === 1 ) { |
|
166 | + if (func_num_args() === 1) { |
|
167 | 167 | |
168 | 168 | self::$static_date_time = func_get_arg(0); |
169 | 169 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | } else { |
173 | 173 | |
174 | - self::$array_date = array( 'year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second ); |
|
174 | + self::$array_date = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second); |
|
175 | 175 | |
176 | 176 | self::$call_type = 'make'; |
177 | 177 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | } |
183 | 183 | |
184 | - public static function between( $date_start, $date_end ) { |
|
184 | + public static function between($date_start, $date_end) { |
|
185 | 185 | |
186 | 186 | self::$date_start = $date_start; |
187 | 187 | |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * Convert from current calendar, what type is current calendar? |
198 | 198 | */ |
199 | - public function from( $calendar ) { |
|
199 | + public function from($calendar) { |
|
200 | 200 | |
201 | - $this->convert = new Convert( $this->date_time ); |
|
201 | + $this->convert = new Convert($this->date_time); |
|
202 | 202 | |
203 | - $this->date_time = $this->convert->from( $calendar ); |
|
203 | + $this->date_time = $this->convert->from($calendar); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * We need this part for DayOf class |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | |
214 | 214 | } |
215 | 215 | |
216 | - public function to( $calendar ) { |
|
216 | + public function to($calendar) { |
|
217 | 217 | |
218 | - $this->convert = new Convert( $this->date_time ); |
|
218 | + $this->convert = new Convert($this->date_time); |
|
219 | 219 | |
220 | - $this->date_time = $this->convert->to( $calendar ); |
|
220 | + $this->date_time = $this->convert->to($calendar); |
|
221 | 221 | |
222 | 222 | /** |
223 | 223 | * We need this part for DayOf class |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | * @param $start datetime |
237 | 237 | * @param $end datetime |
238 | 238 | */ |
239 | - public static function diff( $start, $end ) { |
|
239 | + public static function diff($start, $end) { |
|
240 | 240 | |
241 | - return date_diff( $start, $end ); |
|
241 | + return date_diff($start, $end); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
@@ -247,13 +247,13 @@ discard block |
||
247 | 247 | * @param $value string |
248 | 248 | * @return object |
249 | 249 | */ |
250 | - public function add( $value ) { |
|
250 | + public function add($value) { |
|
251 | 251 | |
252 | - $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value ); |
|
252 | + $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value); |
|
253 | 253 | |
254 | - $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression ); |
|
254 | + $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression); |
|
255 | 255 | |
256 | - $this->date_time->add( new DateInterval( $this->date_interval_expression ) ); |
|
256 | + $this->date_time->add(new DateInterval($this->date_interval_expression)); |
|
257 | 257 | |
258 | 258 | return $this; |
259 | 259 | |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | * @param $value |
265 | 265 | * @return obejct |
266 | 266 | */ |
267 | - public function sub( $value ) { |
|
267 | + public function sub($value) { |
|
268 | 268 | |
269 | - $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value ); |
|
269 | + $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value); |
|
270 | 270 | |
271 | - $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression ); |
|
271 | + $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression); |
|
272 | 272 | |
273 | - $this->date_time->sub( new DateInterval( $this->date_interval_expression ) ); |
|
273 | + $this->date_time->sub(new DateInterval($this->date_interval_expression)); |
|
274 | 274 | |
275 | 275 | return $this; |
276 | 276 | |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | * Check if current year is leap or not |
281 | 281 | * @return boolean |
282 | 282 | */ |
283 | - public function leap( $type = 'gregorian') { |
|
283 | + public function leap($type = 'gregorian') { |
|
284 | 284 | |
285 | - $this->leap = new Leap( $this->date_time->format( 'Y' ), $type ); |
|
285 | + $this->leap = new Leap($this->date_time->format('Y'), $type); |
|
286 | 286 | |
287 | 287 | return $this->leap; |
288 | 288 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public function dayOf() { |
295 | 295 | |
296 | - $this->day_of = new DayOf( $this->date_time, $this->calendar_type ); |
|
296 | + $this->day_of = new DayOf($this->date_time, $this->calendar_type); |
|
297 | 297 | |
298 | 298 | return $this->day_of; |
299 | 299 | |
@@ -304,13 +304,13 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function events() { |
306 | 306 | |
307 | - if ( Datium::$call_type == 'between' ) { |
|
307 | + if (Datium::$call_type == 'between') { |
|
308 | 308 | |
309 | - $this->events = new Events( Datium::$date_start, Datium::$date_end ); |
|
309 | + $this->events = new Events(Datium::$date_start, Datium::$date_end); |
|
310 | 310 | |
311 | 311 | } else { |
312 | 312 | |
313 | - $this->events = new Events( $this->date_time ); |
|
313 | + $this->events = new Events($this->date_time); |
|
314 | 314 | |
315 | 315 | } |
316 | 316 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * |
328 | 328 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
329 | 329 | */ |
330 | - public function object(){ |
|
330 | + public function object() { |
|
331 | 331 | |
332 | 332 | return $this->date_time; |
333 | 333 | |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | * @param $calendar string |
340 | 340 | * @param $format string |
341 | 341 | */ |
342 | - public function get( $format = 'Y-m-d H:i:s' ) { |
|
342 | + public function get($format = 'Y-m-d H:i:s') { |
|
343 | 343 | |
344 | - $fromConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_from ) . '.php' ); |
|
344 | + $fromConfig = include('CalendarSettings/'.ucfirst($this->translate_from).'.php'); |
|
345 | 345 | |
346 | - $toConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_to ) . '.php' ); |
|
346 | + $toConfig = include('CalendarSettings/'.ucfirst($this->translate_to).'.php'); |
|
347 | 347 | |
348 | - $string_date = $this->date_time->format( $format ); |
|
348 | + $string_date = $this->date_time->format($format); |
|
349 | 349 | |
350 | - $string_date = str_replace( $fromConfig['month'], $toConfig['month'], $string_date ); |
|
350 | + $string_date = str_replace($fromConfig['month'], $toConfig['month'], $string_date); |
|
351 | 351 | |
352 | - $string_date = str_replace( $fromConfig['days_of_week'], $toConfig['days_of_week'], $string_date ); |
|
352 | + $string_date = str_replace($fromConfig['days_of_week'], $toConfig['days_of_week'], $string_date); |
|
353 | 353 | |
354 | 354 | return $string_date; |
355 | 355 |
@@ -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 |
@@ -3,48 +3,48 @@ discard block |
||
3 | 3 | use Datium\Datium as Datium; |
4 | 4 | use Datium\Tools\Convert as Covnert; |
5 | 5 | |
6 | -try{ |
|
6 | +try { |
|
7 | 7 | |
8 | -require_once( 'vendor/autoload.php' ); |
|
9 | -var_dump( Datium::create( 1394, 9, 24 )->from( 'shamsi' )->get() ); |
|
10 | -var_dump( Datium::create( 2020, 07, 11 )->to( 'shamsi' )->get() ); |
|
11 | -var_dump( Datium::create( 2020, 07, 11 )->to( 'ghamari' )->get() ); |
|
8 | +require_once('vendor/autoload.php'); |
|
9 | +var_dump(Datium::create(1394, 9, 24)->from('shamsi')->get()); |
|
10 | +var_dump(Datium::create(2020, 07, 11)->to('shamsi')->get()); |
|
11 | +var_dump(Datium::create(2020, 07, 11)->to('ghamari')->get()); |
|
12 | 12 | echo '<br>this year:<br>'; |
13 | -var_dump( Datium::now()->to( 'shamsi' )->get( 'l jS F Y h:i:s A' ) ); |
|
13 | +var_dump(Datium::now()->to('shamsi')->get('l jS F Y h:i:s A')); |
|
14 | 14 | echo "<br>"; |
15 | -var_dump( Datium::now()->to( 'shamsi' )->sub('3 year')->get() ); |
|
15 | +var_dump(Datium::now()->to('shamsi')->sub('3 year')->get()); |
|
16 | 16 | echo "<br>"; |
17 | -var_dump( Datium::now()->to( 'shamsi' )->add('3 year')->get() ); |
|
17 | +var_dump(Datium::now()->to('shamsi')->add('3 year')->get()); |
|
18 | 18 | echo "<br>"; |
19 | -var_dump( Datium::now()->get( 'l jS F Y h:i:s A' ) ); |
|
19 | +var_dump(Datium::now()->get('l jS F Y h:i:s A')); |
|
20 | 20 | echo "<br>Leap year "; |
21 | -var_dump( Datium::now()->leap()->get() ); |
|
21 | +var_dump(Datium::now()->leap()->get()); |
|
22 | 22 | echo "<br>Create new DateTime: "; |
23 | -var_dump( Datium::create(2000, 1, 1, 0, 0, 0)->get() ); |
|
23 | +var_dump(Datium::create(2000, 1, 1, 0, 0, 0)->get()); |
|
24 | 24 | echo "<br>"; |
25 | 25 | echo 'Is next year leap? '; |
26 | -var_dump( Datium::now()->add('1 year')->leap()->get() ); |
|
26 | +var_dump(Datium::now()->add('1 year')->leap()->get()); |
|
27 | 27 | echo "<br>"; |
28 | 28 | echo "Day of Year in gregorian:"; |
29 | 29 | echo "<br>"; |
30 | -var_dump( Datium::now()->dayOf()->year() ); |
|
30 | +var_dump(Datium::now()->dayOf()->year()); |
|
31 | 31 | echo "<br>"; |
32 | 32 | echo "Day of Year in shamsi:"; |
33 | 33 | echo "<br>"; |
34 | -var_dump( Datium::now()->to('shamsi')->dayOf()->year() ); |
|
34 | +var_dump(Datium::now()->to('shamsi')->dayOf()->year()); |
|
35 | 35 | echo "<br>"; |
36 | 36 | echo "Day of Year in ghamari:"; |
37 | 37 | echo "<br>"; |
38 | -var_dump( Datium::now()->to( 'ghamari' )->dayOf()->year() ); |
|
38 | +var_dump(Datium::now()->to('ghamari')->dayOf()->year()); |
|
39 | 39 | echo "<br>"; |
40 | 40 | echo "Day of Week"; |
41 | 41 | echo "<br>"; |
42 | -var_dump( Datium::now()->dayOf()->week() ); |
|
42 | +var_dump(Datium::now()->dayOf()->week()); |
|
43 | 43 | echo "<br>"; |
44 | 44 | echo "Change date form gregorian to shamsi with method: "; |
45 | -var_dump( Datium::create( 1989, 10, 27 )->to( 'shamsi' )->get( 'l jS F Y h:i:s A' ) ); |
|
45 | +var_dump(Datium::create(1989, 10, 27)->to('shamsi')->get('l jS F Y h:i:s A')); |
|
46 | 46 | echo "<br>"; |
47 | -var_dump( Datium::now()->to( 'ghamari' )->get( 'l jS F Y h:i:s A' ) ); |
|
47 | +var_dump(Datium::now()->to('ghamari')->get('l jS F Y h:i:s A')); |
|
48 | 48 | echo "<br>"; |
49 | 49 | echo "<br>"; |
50 | 50 | echo "<br>is persian holiday? "; |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | echo 'return international days'; |
53 | 53 | // var_dump( Datium::between( Datium::now()->object() , Datium::now()->add('4 month')->object() )->events()->international()->get() ); |
54 | 54 | echo 'Convert gregorian to perisan'; |
55 | -var_dump( Datium::now()->to('shamsi')->get() ); |
|
55 | +var_dump(Datium::now()->to('shamsi')->get()); |
|
56 | 56 | echo 'Today\'s events:'; |
57 | 57 | // var_dump( Datium::now()->events()->local( 'ir' )->get() ); |
58 | 58 | echo 'Date diff'; |
59 | -$diff = Datium::diff( Datium::now()->object(), Datium::now()->add('5 day')->object() ); |
|
60 | -var_dump( $diff->days ); |
|
61 | -var_dump( Datium::create( 2015, 11, 9 )->to( 'ghamari' )->get() ); |
|
59 | +$diff = Datium::diff(Datium::now()->object(), Datium::now()->add('5 day')->object()); |
|
60 | +var_dump($diff->days); |
|
61 | +var_dump(Datium::create(2015, 11, 9)->to('ghamari')->get()); |
|
62 | 62 | |
63 | 63 | |
64 | -} catch (Exception $e ) { |
|
64 | +} catch (Exception $e) { |
|
65 | 65 | |
66 | - var_dump( $e ); |
|
66 | + var_dump($e); |
|
67 | 67 | |
68 | 68 | } |