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 | |||
5 | return [ |
||
6 | |||
7 | 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
||
8 | |||
9 | 'am_time' => 'AM', |
||
10 | |||
11 | 'pm_time' => 'PM', |
||
12 | |||
13 | 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
||
14 | |||
15 | |||
16 | |||
17 | /************************************************************ |
||
18 | * Convert to |
||
19 | ************************************************************ |
||
20 | * |
||
21 | * Convert algorith to convert Gregorian to Julian calerndar |
||
22 | * |
||
23 | *\_________________________________________________________/ |
||
24 | */ |
||
25 | View Code Duplication | 'convert_to' => function ($date_time) { |
|
0 ignored issues
–
show
|
|||
26 | |||
27 | $year = $date_time->format('Y'); |
||
28 | |||
29 | $month = $date_time->format('m'); |
||
30 | |||
31 | $day = $date_time->format('d'); |
||
32 | |||
33 | $jd = gregoriantojd($month, $day, $year); |
||
34 | |||
35 | $date = explode('/', jdtojulian( $jd )); |
||
36 | |||
37 | $date_time->setDate($date[2], $date[0], $date[1]); |
||
38 | |||
39 | return $date_time; |
||
40 | |||
41 | }, |
||
42 | |||
43 | /************************************************************ |
||
44 | * Convert From |
||
45 | ************************************************************ |
||
46 | * |
||
47 | * Convert algorith to convert Julian to Gregorian calerndar |
||
48 | * |
||
49 | *\_________________________________________________________/ |
||
50 | */ |
||
51 | View Code Duplication | 'convert_from' => 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. ![]() |
|||
52 | |||
53 | $year = $date_time->format('Y'); |
||
54 | |||
55 | $month = $date_time->format('m'); |
||
56 | |||
57 | $day = $date_time->format('d'); |
||
58 | |||
59 | $date = juliantojd( $month, $day, $year ); |
||
60 | |||
61 | $date = explode('/', JDToGregorian( $date ) ); |
||
62 | |||
63 | $date_time->setDate($date[2], $date[0], $date[1]); |
||
64 | |||
65 | return $date_time; |
||
66 | |||
67 | }, |
||
68 | |||
69 | /************************************************************ |
||
70 | * Shorthand for Julian calendar |
||
71 | ************************************************************ |
||
72 | * |
||
73 | * Julian calendar shorthand |
||
74 | * |
||
75 | *\_________________________________________________________/ |
||
76 | */ |
||
77 | 'shorthand' => 'ju', |
||
78 | |||
79 | /************************************************************ |
||
80 | * Month's name |
||
81 | ************************************************************ |
||
82 | * |
||
83 | * Julian month name |
||
84 | * |
||
85 | *\_________________________________________________________/ |
||
86 | */ |
||
87 | 'month' => array( |
||
88 | |||
89 | 'January', |
||
90 | |||
91 | 'February', |
||
92 | |||
93 | 'March', |
||
94 | |||
95 | 'April', |
||
96 | |||
97 | 'May', |
||
98 | |||
99 | 'June', |
||
100 | |||
101 | 'July', |
||
102 | |||
103 | 'August', |
||
104 | |||
105 | 'September', |
||
106 | |||
107 | 'October', |
||
108 | |||
109 | 'November', |
||
110 | |||
111 | 'December' |
||
112 | |||
113 | ), |
||
114 | |||
115 | /************************************************************ |
||
116 | * Days of Week |
||
117 | ************************************************************ |
||
118 | * |
||
119 | * Here is week days on Julian calendar, offset 0 is first |
||
120 | * day of week and offset 6 is the last one. |
||
121 | * |
||
122 | *\_________________________________________________________/ |
||
123 | */ |
||
124 | 'days_of_week' => array ( |
||
125 | |||
126 | 'Monday', |
||
127 | 'Tuesday', |
||
128 | 'Wednesday', |
||
129 | 'Thursday', |
||
130 | 'Friday', |
||
131 | 'Saturday', |
||
132 | 'Sunday', |
||
133 | ), |
||
134 | |||
135 | |||
136 | 'month_days_number' => array( 1 => 31, |
||
137 | 2 => 28, |
||
138 | 3 => 31, |
||
139 | 4 => 30, |
||
140 | 5 => 31, |
||
141 | 6 => 30, |
||
142 | 7 => 31, |
||
143 | 8 => 31, |
||
144 | 9 => 30, |
||
145 | 10 => 31, |
||
146 | 11 => 30, |
||
147 | 12 => 30 ), |
||
148 | |||
149 | |||
150 | 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. ![]() |
|||
151 | |||
152 | $result = null; |
||
153 | |||
154 | $_month = null; |
||
155 | |||
156 | $config = include 'Julian.php'; |
||
157 | |||
158 | $month = $date_time->format('n'); |
||
159 | |||
160 | $day = $date_time->format('d'); |
||
161 | |||
162 | foreach ($config['month_days_number'] as $_month => $value) { |
||
163 | if ($_month < $month) { |
||
164 | $result += $value; |
||
165 | } |
||
166 | } |
||
167 | |||
168 | $result += $day; |
||
169 | |||
170 | return $result; |
||
171 | |||
172 | }, |
||
173 | |||
174 | View Code Duplication | 'day_of_week' => 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. ![]() |
|||
175 | |||
176 | $config = include 'Julian.php'; |
||
177 | |||
178 | $day = $date_time->format('l'); |
||
179 | |||
180 | foreach ($config['days_of_week'] as $key => $value) { |
||
181 | if ($value == $day) { |
||
182 | return $key += 1; |
||
183 | } |
||
184 | } |
||
185 | |||
186 | }, |
||
187 | |||
188 | /************************************************************ |
||
189 | * Leap year |
||
190 | ************************************************************ |
||
191 | * |
||
192 | * Leap Year formula on Julian calendar |
||
193 | * |
||
194 | *\_________________________________________________________/ |
||
195 | */ |
||
196 | View Code Duplication | 'leap_year' => function ($year) { |
|
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. ![]() |
|||
197 | |||
198 | return ( ( ( $year % 4 ) == 0 ) && ( ( ( $year % 100 ) != 0 ) || ( ( $year % 400 ) == 0 ) ) ); |
||
199 | |||
200 | }, |
||
201 | |||
202 | /************************************************************ |
||
203 | * Weekend |
||
204 | ************************************************************ |
||
205 | * |
||
206 | * Julian weekend |
||
207 | * |
||
208 | *\_________________________________________________________/ |
||
209 | */ |
||
210 | 'weekend' => array( 'saturday', 'sunday' ), |
||
211 | |||
212 | ]; |
||
213 |
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.