Failed Conditions
Branch master (3ce7e2)
by Nick
14:43
created

recess_prettify()   F

Complexity

Conditions 71
Paths 13447

Size

Total Lines 110
Code Lines 91

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 71
eloc 91
c 0
b 0
f 0
nc 13447
nop 4
dl 0
loc 110
rs 2

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
1 ignored issue
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 354 and the first side effect is on line 9.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
/*
4
recess.php 2004-06-05
5
[email protected]
6
*/
7
8
/* UK Parliament */
9
$GLOBALS['recessdates'][1] = array(
10
    2000 => array(
11
        12=>array('more'=>21)
12
    ),
13
    2001 => array(
14
        1=>array('less'=>8),
15
        2=>array('between'=>array(15,26)),
16
        4=>array('between'=>array(10,23)),
17
        5=>array('more'=>13),
18
        6=>array('less'=>13),
19
        7=>array('more'=>20),
20
        8=>array('all'=>1),
21
        9=>array('less'=>14, 'more'=>14),
22
        10=>array('less'=>4, 'between'=>array(4,8, 8,15)),
23
        12=>array('more'=>19) ),
24
    2002 => array(
25
        1=>array('less'=>8),
26
        2=>array('between'=>array(14,25)),
27
        3=>array('more'=>26),
28
        4=>array('less'=>3, 'between'=>array(3,10)),
29
        5=>array('more'=>24),
30
        6=>array('less'=>10),
31
        7=>array('more'=>24),
32
        8=>array('all'=>1),
33
        9=>array('less'=>19, 'more'=>24),
34
        10=>array('less'=>14),
35
        12=>array('more'=>19) ),
36
    2003 => array(
37
        1=>array('less'=>7),
38
        2=>array('between'=>array(13,24)),
39
        4=>array('between'=>array(14,28)),
40
        5=>array('more'=>22),
41
        6=>array('less'=>3),
42
        7=>array('more'=>17),
43
        8=>array('all'=>1),
44
        9=>array('less'=>8, 'more'=>18),
45
        10=>array('less'=>14),
46
        12=>array('more'=>18)),
47
    2004 => array(
48
        1=>array('less'=>5),
49
        2=>array('between'=>array(12,23)),
50
        4=>array('between'=>array(1,19)),
51
        5=>array('more'=>27),
52
        6=>array('less'=>7),
53
        7=>array('more'=>22),
54
        8=>array('all'=>1),
55
        9=>array('less'=>7, 'more'=>16),
56
        10=>array('less'=>11),
57
        12=>array('more'=>21) ),
58
    2005 => array(
59
        1=>array('less'=>10),
60
        2=>array('between'=>array(10,21)),
61
        3=>array('more'=>24),
62
        4=>array('less'=>4, 'more'=>10),
63
        5=>array('less'=>11, 'more'=>26),
64
        6=>array('less'=>6),
65
        7=>array('more'=>21),
66
        8=>array('all'=>1),
67
        9=>array('all'=>1),
68
        10=>array('less'=>10),
69
        12=>array('more'=>20) ),
70
    2006 => array(
71
        1=>array('less'=>9),
72
        2=>array('between'=>array(16,27)),
73
        3=>array('more'=>30),
74
        4=>array('less'=>18),
75
        5=>array('more'=>25),
76
        6=>array('less'=>5),
77
        7=>array('more'=>25),
78
        8=>array('all'=>1),
79
        9=>array('all'=>1),
80
        10=>array('less'=>9),
81
        12=>array('more'=>19),
82
    ),
83
    2007 => array(
84
        1=>array('less'=>8),
85
        2=>array('between'=>array(8,19)),
86
        3=>array('more'=>29),
87
        4=>array('less'=>16),
88
        5=>array('more'=>24),
89
        6=>array('less'=>4),
90
        7=>array('more'=>26),
91
        8=>array('all'=>1),
92
        9=>array('all'=>1),
93
        10=>array('less'=>8),
94
        12=>array('more'=>18),
95
    ),
96
    2008 => array(
97
        1=>array('less'=>7),
98
        2=>array('between'=>array(7,18)),
99
        4=>array('between'=>array(3,21)),
100
        5=>array('more'=>22),
101
        6=>array('less'=>2),
102
        7=>array('more'=>22),
103
        8=>array('all'=>1),
104
        9=>array('all'=>1),
105
        10=>array('less'=>6),
106
        12=>array('more'=>18),
107
    ),
108
    2009 => array(
109
        1=>array('less'=>12),
110
        2=>array('between'=>array(12,23)),
111
        4=>array('between'=>array(2,20)),
112
        5=>array('more'=>21),
113
        6=>array('less'=>1),
114
        7=>array('more'=>21),
115
        8=>array('all'=>1),
116
        9=>array('all'=>1),
117
        10=>array('less'=>12),
118
        12=>array('more'=>16),
119
    ),
120
    2010 => array(
121
        1=>array('less'=>5),
122
        2=>array('between'=>array(10,22)),
123
        3=>array('more'=>30),
124
        4=>array('less'=>6, 'more'=>8),
125
        5=>array('less'=>18, 'more'=>27),
126
        6=>array('less'=>2),
127
        7=>array('more'=>27),
128
        8=>array('all'=>1),
129
        9=>array('less'=>6, 'more'=>16),
130
        10=>array('less'=>11),
131
        12=>array('more'=>21),
132
    ),
133
    2011 => array(
134
        1=>array('less'=>10),
135
        2=>array('between'=>array(17,28)),
136
        4=>array('between'=>array(5,26)),
137
        5=>array('more'=>24),
138
        6=>array('less'=>7),
139
        7=>array('more'=>19),
140
        8=>array('all'=>1),
141
        9=>array('less'=>5, 'more'=>15),
142
        10=>array('less'=>10),
143
        11=>array('between'=>array(15,21)),
144
        12=>array('more'=>20),
145
    ),
146
    2012 => array(
147
        1=>array('less'=>10),
148
        2=>array('between'=>array(9,20)),
149
        3=>array('more'=>27),
150
        4=>array('less'=>16),
151
        5=>array('more'=>24),
152
        6=>array('less'=>11),
153
        7=>array('more'=>17),
154
        8=>array('all'=>1),
155
        9=>array('less'=>3,'more'=>18),
156
        10=>array('less'=>15),
157
        11=>array('between'=>array(13,19)),
158
        12=>array('more'=>20)
159
    ),
160
    2013 => array(
161
        1=>array('less'=>7),
162
        2=>array('between'=>array(14,25)),
163
        3=>array('more'=>26),
164
        4=>array('less'=>15),
165
        5=>array('more'=>21),
166
        6=>array('less'=>3),
167
        7=>array('more'=>18),
168
        8=>array('all'=>1),
169
        9=>array('less'=>2,'more'=>13),
170
        10=>array('less'=>8),
171
        11=>array('between'=>array(12,18)),
172
        12=>array('more'=>19)
173
    ),
174
    2014 => array(
175
        1=>array('less'=>6),
176
        2=>array('between'=>array(13,24)),
177
        4=>array('between'=>array(10,28)),
178
        5=>array('between'=>array(1,6))
179
    ),
180
    2015 => array(
181
        7=>array('more'=>21),
182
        8=>array('all'=>1),
183
        9=>array('less'=>7, 'more'=>17),
184
        10=>array('less'=>12),
185
        11=>array('between'=>array(10,16)),
186
        12=>array('more'=>17)
187
    ),
188
    2016 => array(
189
        1=>array('less'=>5),
190
        2=>array('between'=>array(11,22))
191
    )
192
);
193
# Lords differences
194
$GLOBALS['recessdates'][101] = $GLOBALS['recessdates'][1];
195
$GLOBALS['recessdates'][101][2010][5]['more'] = 26;
196
$GLOBALS['recessdates'][101][2010][7]['more'] = 28;
197
$GLOBALS['recessdates'][101][2010][9] = array('all'=>1);
198
$GLOBALS['recessdates'][101][2010][10]['less'] = 5;
199
$GLOBALS['recessdates'][101][2010][12]['more'] = 22;
200
$GLOBALS['recessdates'][101][2011] = array(
201
    1 => array('less'=>10),
202
    2 => array('between'=>array(16,28)),
203
    4 => array('between'=>array(6,26)),
204
    5 => array('more'=>25),
205
    6 => array('less'=>6),
206
    7 => array('more'=>20),
207
    8 => array('all'=>1),
208
    9 => array('less'=>5, 'more'=>15),
209
    10 => array('less'=>3),
210
    11=>array('between'=>array(16,21)),
211
    12 => array('more'=>21),
212
);
213
214
/* Scottish Parliament */
215
$GLOBALS['recessdates'][4] = array(
216
    1999 => array(
217
        7 => array('more' => 2),
218
        8 => array('less' => 31),
219
        10 => array('between' => array(8,25)),
220
        12 => array('more' => 17)
221
    ),
222
    2000 => array(
223
        1 => array('less' => 10),
224
        4 => array('between' => array(7,25)),
225
        7 => array('more' => 7),
226
        8 => array('all' => 1),
227
        9 => array('less' => 4),
228
        10 => array('between' => array(6,23)),
229
        12 => array('more' => 20)
230
    ),
231
    2001 => array(
232
        1=>array('less'=>8),
233
        2=>array('between'=>array(16,26)),
234
        4=>array('between'=>array(6,23)),
235
        6=>array('more'=>29),
236
        7=>array('all'=>1),
237
        8=>array('all'=>1),
238
        9=>array('less'=>3),
239
        10=>array('between'=>array(5,22)),
240
        12=>array('more'=>21) ),
241
    2002 => array(
242
        1=>array('less'=>7),
243
        2=>array('between'=>array(15,25)),
244
        3=>array('more'=>28),
245
        4=>array('less'=>15),
246
        7=>array('more'=>10),
247
        8=>array('all'=>1),
248
        9=>array('less'=>2),
249
        10=>array('between'=>array(11,28)),
250
        12=>array('more'=>20) ),
251
    2003 => array(
252
        1=>array('less'=>6),
253
        4=>array('between'=>array(0,31)),
254
        5=>array('less'=>2),
255
        6=>array('more'=>27),
256
        7=>array('all'=>1),
257
        8=>array('all'=>1),
258
        10=>array('between'=>array(10,27)),
259
        12=>array('more'=>19)),
260
    2004 => array(
261
        1=>array('less'=>5),
262
        2=>array('between'=>array(13,23)),
263
        4=>array('between'=>array(2,19)),
264
        6=>array('more'=>25),
265
        7=>array('all'=>1),
266
        8=>array('less'=>30),
267
        10=>array('between'=>array(10,23)),
268
        12=>array('more'=>26) ),
269
    2005 => array(
270
        1=>array('less'=>8),
271
        2=>array('between'=>array(11,21)),
272
        3=>array('more'=>24),
273
        4=>array('less'=>11),
274
        7=>array('more'=>1),
275
        8=>array('all'=>1),
276
        9=>array('less'=>5),
277
        10=>array('between'=>array(7,24)),
278
        12=>array('more'=>23) ),
279
    2006 => array(
280
        1=>array('less'=>9),
281
        2=>array('between'=>array(10,20)),
282
        4=>array('less'=>18),
283
        7=>array('more'=>0),
284
        8=>array('all'=>1),
285
        9=>array('less'=>4),
286
        10=>array('between'=>array(6,23)),
287
        12=>array('more'=>22),
288
    ),
289
    2007 => array(
290
        1=>array('less'=>8),
291
        4=>array('more'=>2),
292
        6=>array('more'=>29),
293
        7=>array('all'=>1),
294
        8=>array('all'=>1),
295
        9=>array('less'=>3),
296
        10=>array('between'=>array(5,22)),
297
        12=>array('more'=>21),
298
    ),
299
    2008 => array(
300
        1=>array('less'=>5),
301
        2=>array('between'=>array(8,18)),
302
        3=>array('more'=>28),
303
        4=>array('less'=>14),
304
        6=>array('more'=>27),
305
        7=>array('all'=>1),
306
        8=>array('all'=>1),
307
        10=>array('between'=>array(10,27)),
308
    ),
309
);
310
311
/* NI Assembly */
312
$GLOBALS['recessdates'][5] = array(
313
    2010 => array(
314
        3 => array('more' => 26),
315
        4 => array('less' => 12),
316
        7 => array('more' => 2),
317
        8 => array('all' => 1),
318
        9 => array('less' => 6),
319
        10 => array('more' => 22),
320
        12 => array('more' => 17),
321
    ),
322
    2011 => array(
323
        1 => array('less' => 10),
324
        4 => array('more' => 15),
325
        5 => array('less' => 2),
326
        7 => array('more' => 1),
327
    ),
328
);
329
330
/*
0 ignored issues
show
Unused Code Comprehensibility introduced by
49% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
331
function currently_in_recess() {
332
    // Main file which recesswatcher.py overwrites each day
333
    $h = fopen(RECESSFILE, "r");
334
    $today = date("Y-m-d");
335
    while ($line = fgets($h)) {
336
        list($name, $from, $to) = explode(",", $line);
337
        if ($from <= $today and $today <= $to) {
338
            return array($name, trim($from), trim($to));
339
        }
340
    }
341
    // Second manual override file
342
    $h = fopen(RECESSFILE.".extra", "r");
343
    while ($line = fgets($h)) {
344
        list($name, $from, $to) = explode(",", $line);
345
        if ($from <= $today and $today <= $to) {
346
            return array($name, trim($from), trim($to));
347
        }
348
    }
349
350
    return false;
351
}
352
*/
353
354
function recess_prettify($day, $month, $year, $body) {
355
    global $recessdates;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
356
    $dates = $recessdates[$body];
357
    $recess = 0; $from = ''; $to = '';
358
    if (isset($dates[$year][$month]['all'])) {
359
        $recess = 'Summer Recess';
360
        if (isset($dates[$year][7]['all'])) {
361
            $from = "$year-6-" . $dates[$year][6]['more'];
362
        } else {
363
            $from = "$year-7-" . $dates[$year][7]['more'];
364
        }
365
        if (!isset($dates[$year][9]))
366
            $to = "$year-08-31";
367
        elseif (isset($dates[$year][9]['all']))
368
            $to = "$year-10-" . $dates[$year][10]['less'];
369
        else
370
            $to = "$year-9-" . $dates[$year][9]['less'];
371
    }
372
    if ( (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])
373
    || (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more'])
374
    || (isset($dates[$year][$month]['between']) && $day > $dates[$year][$month]['between'][0] && $day < $dates[$year][$month]['between'][1])
375
    || (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3]) ) {
376
        switch ($month) {
377
            case 1: case 12: $recess = 'Christmas Recess'; break;
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
Coding Style introduced by
Terminating statement must be on a line by itself

As per the PSR-2 coding standard, the break (or other terminating) statement must be on a line of its own.

switch ($expr) {
     case "A":
         doSomething();
         break; //wrong
     case "B":
         doSomething();
         break; //right
     case "C:":
         doSomething();
         return true; //right
 }

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
378
            case 2: if ($body==1 || $body==101) $recess = 'Half Term Week';
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
379
                elseif ($body==4) $recess = 'February Recess';
380
                break;
381
            case 3: if ($body==1 || $body==101) $recess = 'Easter Recess';
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
382
                elseif ($body==4) $recess = 'Spring Recess';
383
                break;
384
            case 4: if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) {
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
385
                    $recess = 'Election Recess';
386
                } elseif ($body==4 && $year==2003) {
387
                    $recess = 'Election Recess';
388
                } elseif ($body==1 || $body==101) {
389
                    $recess = 'Easter Recess';
390
                } elseif ($body==4) {
391
                    $recess = 'Spring Recess';
392
                }
393
                break;
394
            case 5: if ($year==2001 || (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])) {
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
395
                    $recess = 'Election Recess';
396
                } else {
397
                    $recess = 'Whit Recess';
398
                }
399
                break;
400
            case 6: if ($year==2001) {
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
401
                    $recess = 'Election Recess';
402
                } elseif ($body==1 || $body==101) {
403
                    $recess = 'Whit Recess';
404
                } elseif ($body==4) {
405
                    $recess = 'Summer Recess';
406
                } else {
407
                    trigger_error("Argh6");
408
                }
409
                break;
410
            case 7: case 8: $recess = 'Summer Recess';
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
411
                break;
412
            case 9: if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) {
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
413
                    $recess = 'Summer Recess';
414
                } elseif ($body==1 || $body==101) {
415
                    $recess = 'Conference Recess';
416
                } else {
417
                    trigger_error("Argh9");
418
                }
419
                break;
420
            case 10: if ($body==1 || $body==101) $recess = 'Conference Recess';
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
421
                elseif ($body==4) $recess = 'Autumn Recess';
422
                elseif ($body==5) $recess = 'Halloween Recess';
423
                break;
424
            case 11: $recess = 'Autumn Recess';
0 ignored issues
show
Coding Style introduced by
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
425
                break;
426
            default: $recess = 1;
0 ignored issues
show
Coding Style introduced by
The default body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a default statement must start on the line immediately following the statement.

switch ($expr) {
    default:
        doSomething(); //right
        break;
}


switch ($expr) {
    default:

        doSomething(); //wrong
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
427
        }
428
        if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) {
429
            $to = "$year-$month-" . $dates[$year][$month]['less'];
430
            if ($month==1)
431
                $from = ($year-1)."-12-" . $dates[$year-1][12]['more'];
432
            else {
433
                for ($newmonth = $month-1; $newmonth>=1; $newmonth--) {
434
                    if (isset($dates[$year][$newmonth]['more'])) {
435
                        $from = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['more'];
436
                        break;
437
                    }
438
                }
439
            }
440
        }
441
        if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) {
442
            $from = "$year-$month-" . $dates[$year][$month]['more'];
443
            if ($month==12)
444
                $to = ($year+1)."-01-" . $dates[$year+1][1]['less'];
445
            else {
446
                for ($newmonth = $month+1; $newmonth<=12; $newmonth++) {
447
                    if (isset($dates[$year][$newmonth]['less'])) {
448
                        $to = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['less'];
449
                        break;
450
                    }
451
                }
452
            }
453
        }
454
        if (isset($dates[$year][$month]['between']) && $day > $dates[$year][$month]['between'][0] && $day < $dates[$year][$month]['between'][1]) {
455
            $from = "$year-$month-" . $dates[$year][$month]['between'][0];
456
            $to = "$year-$month-" . $dates[$year][$month]['between'][1];
457
        }
458
        if (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3]) {
459
            $from = "$year-$month-" . $dates[$year][$month]['between'][2];
460
            $to = "$year-$month-" . $dates[$year][$month]['between'][3];
461
        }
462
    }
463
    return array($recess, $from, $to);
464
}
465