GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Options   A
last analyzed

Complexity

Total Complexity 36

Size/Duplication

Total Lines 275
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 95
c 2
b 0
f 0
dl 0
loc 275
rs 9.52
wmc 36

16 Methods

Rating   Name   Duplication   Size   Complexity  
A boolean() 0 8 2
A years() 0 10 3
A __construct() 0 4 1
A dates() 0 12 4
A visibilities() 0 14 2
A maritals() 0 9 2
A sizes() 0 8 2
A religions() 0 9 2
A languages() 0 9 2
A status() 0 16 2
A days() 0 16 2
A familyRelationships() 0 20 2
A bloodTypes() 0 9 2
A genders() 0 9 2
A identities() 0 9 2
A months() 0 15 4
1
<?php
2
/**
3
 * This file is part of the O2System Reactor 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\Reactor\Models;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Reactor\Models\Files\Model;
19
20
/**
21
 * Class Options
22
 * @package O2System\Reactor\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 property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug 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 ignore-call  annotation

32
        $this->language->/** @scrutinizer ignore-call */ 
33
                         loadFile('options');

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.

Loading history...
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
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
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
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
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
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
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
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
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
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
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
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
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
Documentation Bug introduced by
Are you sure the doc-type for parameter $end is correct as it would always require null to be passed?
Loading history...
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
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
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
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
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
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
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
                     'TRASH',
253
                 ] as $status
254
        ) {
255
            $statuses[ $status ] = $this->language->getLine($status);
0 ignored issues
show
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
256
        }
257
258
        return $statuses;
259
    }
260
261
    // ------------------------------------------------------------------------
262
263
264
    /**
265
     * @return array
266
     */
267
    public function visibilities()
268
    {
269
        $visibilities = [];
270
271
        foreach ([
272
                     'PUBLIC',
273
                     'PRIVATE',
274
                     'MEMBER',
275
                 ] as $visibility
276
        ) {
277
            $visibilities[ $visibility ] = $this->language->getLine($visibility);
0 ignored issues
show
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
278
        }
279
280
        return $visibilities;
281
    }
282
283
    // ------------------------------------------------------------------------
284
285
    /**
286
     * Options::languages
287
     *
288
     * @return array
289
     */
290
    public function languages()
291
    {
292
        $languages = [];
293
294
        foreach ($this->language->getRegistry() as $language) {
0 ignored issues
show
Bug Best Practice introduced by
The property language does not exist on O2System\Reactor\Models\Options. Since you implemented __get, consider adding a @property annotation.
Loading history...
295
            $languages[ $language->getParameter() ] = $language->getProperties()->name;
296
        }
297
298
        return $languages;
299
    }
300
}