This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use OpenCafe\Datium as Datium; |
||
4 | use OpenCafe\Tools\Leap as Leap; |
||
5 | |||
6 | return array ( |
||
7 | |||
8 | /************************************************************ |
||
9 | * Convert to |
||
10 | ************************************************************ |
||
11 | * |
||
12 | * Convert algorith to convert Gregorian to Hijri calerndar |
||
13 | * |
||
14 | *\_________________________________________________________/ |
||
15 | */ |
||
16 | 'convert_to' => function ($date_time) { |
||
17 | |||
18 | $config = include 'Jalali.php'; |
||
19 | |||
20 | $date_time = Datium::create($date_time)->to('jalali')->object(); |
||
0 ignored issues
–
show
|
|||
21 | |||
22 | $year = $date_time->format('Y'); |
||
23 | |||
24 | $month = $date_time->format('n'); |
||
25 | |||
26 | $day = $date_time->format('d'); |
||
27 | |||
28 | $temp_day = 0 ; |
||
29 | |||
30 | View Code Duplication | for ($i = 1; $i < $month; $i++) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
31 | $temp_day += $config[ 'month_days_number' ][ $i ]; |
||
32 | } |
||
33 | |||
34 | $temp_day += $day; |
||
35 | |||
36 | $leap = new Leap($year); |
||
37 | |||
38 | if ($leap->get() && $month > 11) { |
||
39 | $temp_day++; |
||
40 | } |
||
41 | |||
42 | $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
||
43 | |||
44 | $_year = explode('.', $_year); |
||
45 | |||
46 | $year = $_year[0]; |
||
47 | |||
48 | $_month = $_year[1]; |
||
49 | |||
50 | $var_temp = '0.0'; |
||
51 | |||
52 | for ($i = strlen($_month); $i > 2; $i--) { |
||
53 | $var_temp .= '0'; |
||
54 | } |
||
55 | |||
56 | $var_temp .= '1'; |
||
57 | |||
58 | $_month = $_month * $var_temp ; |
||
59 | |||
60 | $_month = ( $_month * 12 ) + 1; |
||
61 | |||
62 | $_month = explode('.', $_month); |
||
63 | |||
64 | $month = $_month[0]; |
||
65 | |||
66 | $_day = $_month[1]; |
||
67 | |||
68 | $var_temp = '0.0'; |
||
69 | |||
70 | for ($i = strlen($_day); $i > 2; $i--) { |
||
71 | $var_temp .= '0' ; |
||
72 | } |
||
73 | |||
74 | $var_temp .= '1'; |
||
75 | |||
76 | $_day = $_day * $var_temp; |
||
77 | |||
78 | $_day = ( $_day * 29.530 ); |
||
79 | |||
80 | $_day = explode('.', $_day); |
||
81 | |||
82 | $day = $_day[0]; |
||
83 | |||
84 | $date_time->setDate($year, $month, $day); |
||
85 | |||
86 | return $date_time; |
||
87 | |||
88 | }, |
||
89 | |||
90 | /************************************************************ |
||
91 | * Convert From |
||
92 | ************************************************************ |
||
93 | * |
||
94 | * Convert algorith to convert Hijri to Gregorian calerndar |
||
95 | * |
||
96 | *\_________________________________________________________/ |
||
97 | */ |
||
98 | 'convert_from' => function ($date_time) { |
||
99 | |||
100 | $config = include 'Gregorian.php'; |
||
101 | |||
102 | $year = $date_time->format('Y'); |
||
103 | |||
104 | $month = $date_time->format('m'); |
||
105 | |||
106 | $day = $date_time->format('d'); |
||
107 | |||
108 | $jd = (int)((11 * $year + 3) / 30) + 354 * $year + |
||
109 | 30 * $month -(int)(($month - 1) / 2) + $day + 1948440 - 385; |
||
110 | |||
111 | $result = explode('/', jdtogregorian($jd)); |
||
112 | |||
113 | $month = $result[0]; |
||
114 | |||
115 | $day = $result[1]; |
||
116 | |||
117 | $year = $result[2]; |
||
118 | |||
119 | if (! $day || $config['leap_year']($year - 1) ) { |
||
120 | $day++; |
||
121 | } |
||
122 | |||
123 | $date_time->setDate($year, $month, $day); |
||
124 | |||
125 | return $date_time; |
||
126 | |||
127 | |||
128 | }, |
||
129 | |||
130 | /************************************************************ |
||
131 | * Shorthand for Hijri calendar |
||
132 | ************************************************************ |
||
133 | * |
||
134 | * Hijri calendar shorthand |
||
135 | * |
||
136 | *\_________________________________________________________/ |
||
137 | */ |
||
138 | 'shorthand' => 'hi', |
||
139 | |||
140 | /************************************************************ |
||
141 | * Month's name |
||
142 | ************************************************************ |
||
143 | * |
||
144 | * Hijri month name |
||
145 | * |
||
146 | *\_________________________________________________________/ |
||
147 | */ |
||
148 | 'month' => array ( |
||
149 | |||
150 | 'Muharram', |
||
151 | |||
152 | 'Safar', |
||
153 | |||
154 | 'Rabi I', |
||
155 | |||
156 | 'Rabi II', |
||
157 | |||
158 | 'Jumada I', |
||
159 | |||
160 | 'Jumada II', |
||
161 | |||
162 | 'Rajab', |
||
163 | |||
164 | 'Shaban', |
||
165 | |||
166 | 'Ramadan', |
||
167 | |||
168 | 'Shawwal', |
||
169 | |||
170 | 'Dhu al_Qadah', |
||
171 | |||
172 | 'Dhu al_Hijjah' |
||
173 | |||
174 | ), |
||
175 | |||
176 | /************************************************************ |
||
177 | * Days of Week |
||
178 | ************************************************************ |
||
179 | * |
||
180 | * Here is week days on Hijri calendar, offset 0 is first |
||
181 | * day of week and offset 6 is the last one. |
||
182 | * |
||
183 | *\_________________________________________________________/ |
||
184 | */ |
||
185 | 'days_of_week' => array ( |
||
186 | |||
187 | 'al-Aḥad', |
||
188 | 'al-Ithnayn', |
||
189 | 'ath-Thulatha\'', |
||
190 | 'al-Arbi\'a', |
||
191 | 'al-Khamees', |
||
192 | 'al-Jumu\'ah', |
||
193 | 'as-Sabt', |
||
194 | ), |
||
195 | |||
196 | 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
||
197 | |||
198 | 'am_time' => 'AM', |
||
199 | |||
200 | 'pm_time' => 'PM', |
||
201 | |||
202 | 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
||
203 | |||
204 | |||
205 | |||
206 | |||
207 | 'month_days_number' => array( 1 => 30, |
||
208 | 2 => 29, |
||
209 | 3 => 30, |
||
210 | 4 => 30, |
||
211 | 5 => 29, |
||
212 | 6 => 29, |
||
213 | 7 => 30, |
||
214 | 8 => 29, |
||
215 | 9 => 30, |
||
216 | 10 => 29, |
||
217 | 11 => 30, |
||
218 | 12 => 30 ), |
||
219 | /************************************************************ |
||
220 | * Day of year |
||
221 | ************************************************************ |
||
222 | * |
||
223 | * Return days of year on Hijri cleander |
||
224 | * |
||
225 | *\_________________________________________________________/ |
||
226 | */ |
||
227 | View Code Duplication | 'day_of_year' => function ($date_time) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
228 | |||
229 | $result = null; |
||
230 | |||
231 | $config = include 'Hijri.php'; |
||
232 | |||
233 | $month = $date_time->format('n'); |
||
234 | |||
235 | $day = $date_time->format('d'); |
||
236 | |||
237 | foreach ($config['month_days_number'] as $_month => $value) { |
||
238 | if ($_month < $month) { |
||
239 | $result += $value; |
||
240 | } |
||
241 | } |
||
242 | |||
243 | $result += $day; |
||
244 | |||
245 | return $result; |
||
246 | |||
247 | }, |
||
248 | |||
249 | /************************************************************ |
||
250 | * Day of week |
||
251 | ************************************************************ |
||
252 | * |
||
253 | * Return day of week on Hijri calendar |
||
254 | * example : al-Aḥad = result is 1 |
||
255 | *\_________________________________________________________/ |
||
256 | */ |
||
257 | View Code Duplication | 'day_of_week' => function ($date_time, $day_of_week) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
258 | |||
259 | $days_of_week = array( |
||
260 | 'al-Ithnayn', |
||
261 | 'ath-Thulatha\'', |
||
262 | 'al-Arbi\'a', |
||
263 | 'al-Khamees', |
||
264 | 'al-Jumu\'ah', |
||
265 | 'as-Sabt', |
||
266 | 'al-Aḥad', |
||
267 | ); |
||
268 | |||
269 | $days = array( |
||
270 | 1 => 'al-Aḥad', |
||
271 | 2 => 'al-Ithnayn', |
||
272 | 3 => 'ath-Thulatha\'', |
||
273 | 4 => 'al-Arbi\'a', |
||
274 | 5 => 'al-Khamees', |
||
275 | 6 => 'al-Jumu\'ah', |
||
276 | 7 => 'as-Sabt', |
||
277 | ); |
||
278 | |||
279 | $configGregorian = include 'Gregorian.php'; |
||
280 | |||
281 | $day = str_replace($configGregorian['days_of_week'], $days_of_week, $day_of_week); |
||
282 | |||
283 | foreach ($days as $key => $value) { |
||
284 | if ($value == $day) { |
||
285 | return $key; |
||
286 | } |
||
287 | } |
||
288 | |||
289 | }, |
||
290 | |||
291 | /************************************************************ |
||
292 | * Leap year |
||
293 | ************************************************************ |
||
294 | * |
||
295 | * Leap Year formula on Hijri calendar |
||
296 | * |
||
297 | *\_________________________________________________________/ |
||
298 | */ |
||
299 | 'leap_year' => function ($year) { |
||
300 | $result = $this->year % 30; |
||
0 ignored issues
–
show
|
|||
301 | |||
302 | if (( 2 == $result ) |
||
303 | || ( 5 == $result ) |
||
304 | || ( 7 == $result ) |
||
305 | || ( 10 == $result ) |
||
306 | || ( 13 == $result ) |
||
307 | || ( 16 == $result ) |
||
308 | || ( 18 == $result ) |
||
309 | || ( 21 == $result ) |
||
310 | || ( 24 == $year ) |
||
311 | || ( 26 == $result ) |
||
312 | || ( 29 == $result ) |
||
313 | ) { |
||
314 | return $result; |
||
315 | } |
||
316 | }, |
||
317 | |||
318 | /************************************************************ |
||
319 | * Weekend |
||
320 | ************************************************************ |
||
321 | * |
||
322 | * weekend in Hijri calendar / arabic countries and some islamic countries |
||
323 | * |
||
324 | *\_________________________________________________________/ |
||
325 | */ |
||
326 | 'weekend' => array( 'friday', 'saturday' ), |
||
327 | |||
328 | ); |
||
329 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: