1 | <?php |
||||||
2 | /** |
||||||
3 | * This file is part of the O2System Framework package. |
||||||
4 | * |
||||||
5 | * For the full copyright and license information, please view the LICENSE |
||||||
6 | * file that was distributed with this source code. |
||||||
7 | * |
||||||
8 | * @author Steeve Andrian Salim |
||||||
9 | * @copyright Copyright (c) Steeve Andrian Salim |
||||||
10 | */ |
||||||
11 | |||||||
12 | // ------------------------------------------------------------------------ |
||||||
13 | |||||||
14 | namespace O2System\Framework\Models; |
||||||
15 | |||||||
16 | // ------------------------------------------------------------------------ |
||||||
17 | |||||||
18 | use O2System\Framework\Models\Files\Model; |
||||||
19 | |||||||
20 | /** |
||||||
21 | * Class Options |
||||||
22 | * @package O2System\Framework\Models |
||||||
23 | */ |
||||||
24 | class Options extends Model |
||||||
25 | { |
||||||
26 | /** |
||||||
27 | * Options constructor. |
||||||
28 | */ |
||||||
29 | public function __construct() |
||||||
30 | { |
||||||
31 | parent::__construct(); |
||||||
32 | $this->language->loadFile('options'); |
||||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() The method
loadFile() does not exist on null .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
33 | } |
||||||
34 | |||||||
35 | /** |
||||||
36 | * @return array |
||||||
37 | */ |
||||||
38 | public function religions() |
||||||
39 | { |
||||||
40 | $religions = []; |
||||||
41 | |||||||
42 | foreach (['ATHEIST', 'HINDU', 'BUDDHA', 'MOSLEM', 'CHRISTIAN', 'CATHOLIC', 'UNDEFINED'] as $religion) { |
||||||
43 | $religions[ $religion ] = $this->language->getLine($religion); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
44 | } |
||||||
45 | |||||||
46 | return $religions; |
||||||
47 | } |
||||||
48 | |||||||
49 | /** |
||||||
50 | * @return array |
||||||
51 | */ |
||||||
52 | public function genders() |
||||||
53 | { |
||||||
54 | $genders = []; |
||||||
55 | |||||||
56 | foreach (['MALE', 'FEMALE', 'UNDEFINED'] as $gender) { |
||||||
57 | $genders[ $gender ] = $this->language->getLine($gender); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
58 | } |
||||||
59 | |||||||
60 | return $genders; |
||||||
61 | } |
||||||
62 | |||||||
63 | /** |
||||||
64 | * @return array |
||||||
65 | */ |
||||||
66 | public function maritals() |
||||||
67 | { |
||||||
68 | $maritals = []; |
||||||
69 | |||||||
70 | foreach (['SINGLE', 'MARRIED', 'DIVORCED', 'UNDEFINED'] as $marital) { |
||||||
71 | $maritals[ $marital ] = $this->language->getLine($marital); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
72 | } |
||||||
73 | |||||||
74 | return $maritals; |
||||||
75 | } |
||||||
76 | |||||||
77 | /** |
||||||
78 | * @return array |
||||||
79 | */ |
||||||
80 | public function bloodTypes() |
||||||
81 | { |
||||||
82 | $bloodTypes = []; |
||||||
83 | |||||||
84 | foreach (['A', 'B', 'AB', 'O', 'UNDEFINED'] as $bloodType) { |
||||||
85 | $bloodTypes[ $bloodType ] = $this->language->getLine($bloodType); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
86 | } |
||||||
87 | |||||||
88 | return $bloodTypes; |
||||||
89 | } |
||||||
90 | |||||||
91 | /** |
||||||
92 | * @param int $start |
||||||
93 | * @param int $end |
||||||
94 | * @param string $labelFormat |
||||||
95 | * @return array |
||||||
96 | */ |
||||||
97 | public function days($start = 1, $end = 7, $labelFormat = 'l') |
||||||
98 | { |
||||||
99 | $this->language->loadFile('calendar'); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
100 | |||||||
101 | $year = date('o'); |
||||||
102 | $week = date('W'); |
||||||
103 | |||||||
104 | $days = []; |
||||||
105 | |||||||
106 | for ($i = $start; $i <= $end; $i++) { |
||||||
107 | $time = strtotime($year . 'W' . $week . $i); |
||||||
108 | $days[ strtoupper(date('D', $time)) ] = $this->language->getLine( |
||||||
109 | 'CAL_' . strtoupper(date($labelFormat, $time))); |
||||||
110 | } |
||||||
111 | |||||||
112 | return $days; |
||||||
113 | } |
||||||
114 | |||||||
115 | /** |
||||||
116 | * @param int $start |
||||||
117 | * @param int $end |
||||||
118 | * @param bool $leading |
||||||
119 | * @return array |
||||||
120 | */ |
||||||
121 | public function dates($start = 1, $end = 31, $leading = true) |
||||||
122 | { |
||||||
123 | $dates = []; |
||||||
124 | |||||||
125 | foreach (range($start, $end) as $date) { |
||||||
126 | if ($leading) { |
||||||
127 | $date = strlen($date) == 1 ? '0' . $date : $date; |
||||||
128 | } |
||||||
129 | $dates[ $date ] = $date; |
||||||
130 | } |
||||||
131 | |||||||
132 | return $dates; |
||||||
133 | } |
||||||
134 | |||||||
135 | /** |
||||||
136 | * @param int $start |
||||||
137 | * @param int $end |
||||||
138 | * @param bool $leading |
||||||
139 | * @return array |
||||||
140 | */ |
||||||
141 | public function months($start = 1, $end = 12, $leading = true) |
||||||
142 | { |
||||||
143 | $this->language->loadFile('calendar'); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
144 | |||||||
145 | $months = []; |
||||||
146 | |||||||
147 | foreach (range($start, $end) as $month) { |
||||||
148 | if ($leading) { |
||||||
149 | $month = strlen($month) == 1 ? '0' . $month : $month; |
||||||
150 | } |
||||||
151 | $months[ $month ] = $this->language->getLine(strtoupper('CAL_' . date('F', |
||||||
152 | strtotime('1-' . $month . '-2000')))); |
||||||
153 | } |
||||||
154 | |||||||
155 | return $months; |
||||||
156 | } |
||||||
157 | |||||||
158 | /** |
||||||
159 | * @param int $start |
||||||
160 | * @param null $end |
||||||
0 ignored issues
–
show
|
|||||||
161 | * @return array |
||||||
162 | */ |
||||||
163 | public function years($start = 1900, $end = null) |
||||||
164 | { |
||||||
165 | $end = empty($end) ? date('Y') : $end; |
||||||
166 | $years = []; |
||||||
167 | |||||||
168 | foreach (range($start, $end) as $year) { |
||||||
169 | $years[ $year ] = $year; |
||||||
170 | } |
||||||
171 | |||||||
172 | return $years; |
||||||
173 | } |
||||||
174 | |||||||
175 | /** |
||||||
176 | * @return array |
||||||
177 | */ |
||||||
178 | public function identities() |
||||||
179 | { |
||||||
180 | $identities = []; |
||||||
181 | |||||||
182 | foreach (['UNDEFINED', 'IDENTITY_CARD', 'STUDENT_CARD', 'DRIVER_LICENSE', 'PASSPORT'] as $identity) { |
||||||
183 | $identities[ $identity ] = $this->language->getLine($identity); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
184 | } |
||||||
185 | |||||||
186 | return $identities; |
||||||
187 | } |
||||||
188 | |||||||
189 | /** |
||||||
190 | * @return array |
||||||
191 | */ |
||||||
192 | public function sizes() |
||||||
193 | { |
||||||
194 | $sizes = []; |
||||||
195 | foreach (['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'] as $size) { |
||||||
196 | $sizes[ $size ] = $size; |
||||||
197 | } |
||||||
198 | |||||||
199 | return $sizes; |
||||||
200 | } |
||||||
201 | |||||||
202 | /** |
||||||
203 | * @return array |
||||||
204 | */ |
||||||
205 | public function boolean() |
||||||
206 | { |
||||||
207 | $boolean = []; |
||||||
208 | foreach (['YES', 'NO'] as $bool) { |
||||||
209 | $boolean[ $bool ] = $this->language->getLine('BOOL_' . $bool); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
210 | } |
||||||
211 | |||||||
212 | return $boolean; |
||||||
213 | } |
||||||
214 | |||||||
215 | /** |
||||||
216 | * @return array |
||||||
217 | */ |
||||||
218 | public function familyRelationships() |
||||||
219 | { |
||||||
220 | $familyRelationships = []; |
||||||
221 | |||||||
222 | foreach ([ |
||||||
223 | 'PARENT', |
||||||
224 | 'CHILD', |
||||||
225 | 'SPOUSE', |
||||||
226 | 'SIBLING', |
||||||
227 | 'GRANDPARENTS', |
||||||
228 | 'GRANDCHILD', |
||||||
229 | 'PARENTS_SIBLING', |
||||||
230 | 'SIBLINGS_CHILD', |
||||||
231 | 'AUNTS_UNCLES_CHILD', |
||||||
232 | ] as $relationship |
||||||
233 | ) { |
||||||
234 | $familyRelationships[ $relationship ] = $this->language->getLine($relationship); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
235 | } |
||||||
236 | |||||||
237 | return $familyRelationships; |
||||||
238 | } |
||||||
239 | |||||||
240 | /** |
||||||
241 | * @return array |
||||||
242 | */ |
||||||
243 | public function status() |
||||||
244 | { |
||||||
245 | $statuses = []; |
||||||
246 | |||||||
247 | foreach ([ |
||||||
248 | 'PUBLISH', |
||||||
249 | 'UNPUBLISH', |
||||||
250 | 'DRAFT', |
||||||
251 | 'ARCHIVED', |
||||||
252 | 'DELETED', |
||||||
253 | 'LOCKED' |
||||||
254 | ] as $status |
||||||
255 | ) { |
||||||
256 | $statuses[ $status ] = $this->language->getLine($status); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
257 | } |
||||||
258 | |||||||
259 | return $statuses; |
||||||
260 | } |
||||||
261 | |||||||
262 | // ------------------------------------------------------------------------ |
||||||
263 | |||||||
264 | |||||||
265 | /** |
||||||
266 | * @return array |
||||||
267 | */ |
||||||
268 | public function visibilities() |
||||||
269 | { |
||||||
270 | $visibilities = []; |
||||||
271 | |||||||
272 | foreach ([ |
||||||
273 | 'PUBLIC', |
||||||
274 | 'PROTECTED', |
||||||
275 | 'PRIVATE', |
||||||
276 | 'READONLY', |
||||||
277 | 'MEMBERONLY', |
||||||
278 | ] as $visibility |
||||||
279 | ) { |
||||||
280 | $visibilities[ $visibility ] = $this->language->getLine($visibility); |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
281 | } |
||||||
282 | |||||||
283 | return $visibilities; |
||||||
284 | } |
||||||
285 | |||||||
286 | // ------------------------------------------------------------------------ |
||||||
287 | |||||||
288 | /** |
||||||
289 | * Options::languages |
||||||
290 | * |
||||||
291 | * @return array |
||||||
292 | */ |
||||||
293 | public function languages() |
||||||
294 | { |
||||||
295 | $languages = []; |
||||||
296 | |||||||
297 | foreach ($this->language->getRegistry() as $language) { |
||||||
0 ignored issues
–
show
The property
language does not exist on O2System\Framework\Models\Options . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
298 | $languages[ $language->getParameter() ] = $language->getProperties()->name; |
||||||
299 | } |
||||||
300 | |||||||
301 | return $languages; |
||||||
302 | } |
||||||
303 | } |