Completed
Push — develop ( d19f73...aa97bb )
by
unknown
08:38
created

Date   F

Complexity

Total Complexity 76

Size/Duplication

Total Lines 431
Duplicated Lines 1.62 %

Coupling/Cohesion

Components 4
Dependencies 6

Importance

Changes 11
Bugs 2 Features 1
Metric Value
c 11
b 2
f 1
dl 7
loc 431
rs 2.2388
wmc 76
lcom 4
cbo 6

15 Methods

Rating   Name   Duplication   Size   Complexity  
A setExcelCalendar() 0 9 3
A getExcelCalendar() 0 4 1
A setDefaultTimezone() 0 8 2
A getDefaultTimezone() 0 7 2
A validateTimeZone() 0 9 4
B excelToDateTimeObject() 0 27 5
A excelToTimestamp() 0 5 1
C PHPToExcel() 0 23 7
B formattedPHPToExcel() 0 34 5
A isDateTime() 0 8 1
A isDateTimeFormat() 0 4 1
C isDateTimeFormatCode() 0 64 32
B stringToExcel() 7 24 6
A monthStringToNumber() 0 11 4
A dayStringToNumber() 0 8 2

How to fix   Duplicated Code    Complexity   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like Date often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Date, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace PHPExcel\Shared;
4
5
/**
6
 * \PHPExcel\Shared\Date
7
 *
8
 * Copyright (c) 2006 - 2015 PHPExcel
9
 *
10
 * This library is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU Lesser General Public
12
 * License as published by the Free Software Foundation; either
13
 * version 2.1 of the License, or (at your option) any later version.
14
 *
15
 * This library is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
 * Lesser General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU Lesser General Public
21
 * License along with this library; if not, write to the Free Software
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23
 *
24
 * @category   PHPExcel
25
 * @package    PHPExcel_Shared
26
 * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
27
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
28
 * @version    ##VERSION##, ##DATE##
29
 */
30
class Date
31
{
32
    /** constants */
33
    const CALENDAR_WINDOWS_1900 = 1900;        //    Base date of 1st Jan 1900 = 1.0
34
    const CALENDAR_MAC_1904 = 1904;            //    Base date of 2nd Jan 1904 = 1.0
35
36
    /*
37
     * Names of the months of the year, indexed by shortname
38
     * Planned usage for locale settings
39
     *
40
     * @public
41
     * @var    string[]
42
     */
43
    public static $monthNames = [
44
        'Jan' => 'January',
45
        'Feb' => 'February',
46
        'Mar' => 'March',
47
        'Apr' => 'April',
48
        'May' => 'May',
49
        'Jun' => 'June',
50
        'Jul' => 'July',
51
        'Aug' => 'August',
52
        'Sep' => 'September',
53
        'Oct' => 'October',
54
        'Nov' => 'November',
55
        'Dec' => 'December',
56
    ];
57
58
    /*
59
     * @public
60
     * @var    string[]
61
     */
62
    public static $numberSuffixes = [
63
        'st',
64
        'nd',
65
        'rd',
66
        'th',
67
    ];
68
69
    /*
70
     * Base calendar year to use for calculations
71
     * Value is either CALENDAR_WINDOWS_1900 (1900) or CALENDAR_MAC_1904 (1904)
72
     *
73
     * @private
74
     * @var    int
75
     */
76
    protected static $excelCalendar = self::CALENDAR_WINDOWS_1900;
77
78
    /*
79
     * Default timezone to use for DateTime objects
80
     *
81
     * @private
82
     * @var    null|\DateTimeZone
83
     */
84
    protected static $defaultTimeZone;
85
86
    /**
87
     * Set the Excel calendar (Windows 1900 or Mac 1904)
88
     *
89
     * @param     integer    $baseDate           Excel base date (1900 or 1904)
90
     * @return    boolean                        Success or failure
91
     */
92
    public static function setExcelCalendar($baseDate)
93
    {
94
        if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
95
            ($baseDate == self::CALENDAR_MAC_1904)) {
96
            self::$excelCalendar = $baseDate;
97
            return true;
98
        }
99
        return false;
100
    }
101
102
    /**
103
     * Return the Excel calendar (Windows 1900 or Mac 1904)
104
     *
105
     * @return     integer    Excel base date (1900 or 1904)
106
     */
107
    public static function getExcelCalendar()
108
    {
109
        return self::$excelCalendar;
110
    }
111
112
    /**
113
     * Set the Default timezone to use for dates
114
     *
115
     * @param     string|\DateTimeZone    $timezone    The timezone to set for all Excel datetimestamp to PHP DateTime Object conversions
0 ignored issues
show
Documentation introduced by
There is no parameter named $timezone. Did you maybe mean $timeZone?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
116
     * @return    boolean                              Success or failure
117
     * @throws    \Exception
118
     */
119
    public static function setDefaultTimezone($timeZone)
120
    {
121
        if ($timeZone = self::validateTimeZone($timeZone)) {
122
            self::$defaultTimeZone = $timeZone;
123
            return true;
124
        }
125
        return false;
126
    }
127
128
    /**
129
     * Return the Default timezone being used for dates
130
     *
131
     * @return     \DateTimeZone    The timezone being used as default for Excel timestamp to PHP DateTime object
132
     */
133
    public static function getDefaultTimezone()
134
    {
135
        if (self::$defaultTimeZone === null) {
136
            self::$defaultTimeZone = new \DateTimeZone('UTC');
137
        }
138
        return self::$defaultTimeZone;
139
    }
140
141
    /**
142
     * Validate a timezone
143
     *
144
     * @param     string|\DateTimeZone    $timezone    The timezone to validate, either as a timezone string or object
0 ignored issues
show
Documentation introduced by
There is no parameter named $timezone. Did you maybe mean $timeZone?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
145
     * @return    \DateTimeZone                        The timezone as a timezone object
146
     * @throws    \Exception
147
     */
148
    protected static function validateTimeZone($timeZone)
149
    {
150
        if (is_object($timeZone) && $timeZone instanceof \DateTimeZone) {
151
            return $timeZone;
152
        } elseif (is_string($timeZone)) {
153
            return new \DateTimeZone($timeZone);
154
        }
155
        throw new \Exception('Invalid timezone');
156
    }
157
158
    /**
159
     * Convert a MS serialized datetime value from Excel to a PHP Date/Time object
160
     *
161
     * @param     integer|float    $dateValue        MS Excel serialized date/time value
0 ignored issues
show
Bug introduced by
There is no parameter named $dateValue. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
162
     * @param     \DateTimeZone|string|null          $timezone            The timezone to assume for the Excel timestamp,
0 ignored issues
show
Documentation introduced by
There is no parameter named $timezone. Did you maybe mean $timeZone?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
163
     *                                                                        if you don't want to treat it as a UTC value
164
     *                                                                    Use the default (UST) unless you absolutely need a conversion
165
     * @return    \DateTime                          PHP date/time object
166
     * @throws    \Exception
167
     */
168
    public static function excelToDateTimeObject($excelTimestamp = 0, $timeZone = null)
169
    {
170
        $timeZone = ($timeZone === null) ? self::getDefaultTimezone() : self::validateTimeZone($timeZone);
171
        if ($excelTimestamp < 1.0) {
172
            // Unix timestamp base date
173
            $baseDate = new \DateTime('1970-01-01', $timeZone);
174
        } else {
175
            // MS Excel calendar base dates
176
            if (self::$excelCalendar == self::CALENDAR_WINDOWS_1900) {
177
                // Allow adjustment for 1900 Leap Year in MS Excel
178
                $baseDate = ($excelTimestamp < 60) ? new \DateTime('1899-12-31', $timeZone) : new \DateTime('1899-12-30', $timeZone);
179
            } else {
180
                $baseDate = new \DateTime('1904-01-01', $timeZone);
181
            }
182
        }
183
        $days = floor($excelTimestamp);
184
        $partDay = $excelTimestamp - $days;
185
        $hours = floor($partDay * 24);
186
        $partDay = $partDay * 24 - $hours;
187
        $minutes = floor($partDay * 60);
188
        $partDay = $partDay * 60 - $minutes;
189
        $seconds = round($partDay * 60);
190
191
        $interval = '+' . $days . ' days';
192
        return $baseDate->modify($interval)
193
            ->setTime($hours, $minutes, $seconds);
194
    }
195
196
    /**
197
     * Convert a MS serialized datetime value from Excel to a unix timestamp
198
     *
199
     * @param     integer|float    $dateValue        MS Excel serialized date/time value
0 ignored issues
show
Bug introduced by
There is no parameter named $dateValue. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
200
     * @param     \DateTimeZone|string|null          $timezone            The timezone to assume for the Excel timestamp,
0 ignored issues
show
Documentation introduced by
There is no parameter named $timezone. Did you maybe mean $timeZone?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
201
     *                                                                        if you don't want to treat it as a UTC value
202
     *                                                                    Use the default (UST) unless you absolutely need a conversion
203
     * @return    integer                            Unix timetamp for this date/time
204
     * @throws    \Exception
205
     */
206
    public static function excelToTimestamp($excelTimestamp = 0, $timeZone = null)
207
    {
208
        return (int) self::excelToDateTimeObject($excelTimestamp, $timeZone)
209
            ->format('U');
210
    }
211
212
213
    /**
214
     *    Convert a date from PHP to Excel
215
     *
216
     *    @param    mixed        $dateValue            PHP serialized date/time or date object
217
     *    @param    boolean        $adjustToTimezone    Flag indicating whether $dateValue should be treated as
218
     *                                                    a UST timestamp, or adjusted to UST
219
     *    @param    string         $timezone            The timezone for finding the adjustment from UST
220
     *    @return    mixed        Excel date/time value
221
     *                            or boolean FALSE on failure
222
     */
223
    public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null)
224
    {
225
        $saveTimeZone = date_default_timezone_get();
226
        date_default_timezone_set('UTC');
227
228
        $timezoneAdjustment = ($adjustToTimezone) ?
229
            PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone ? $timezone : $saveTimeZone, $dateValue) :
230
            0;
231
232
        $retValue = false;
233
        if ((is_object($dateValue)) && ($dateValue instanceof \DateTimeInterface)) {
234
            $dateValue->add(new \DateInterval('PT' . $timezoneAdjustment . 'S'));
235
            $retValue = self::formattedPHPToExcel($dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'), $dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s'));
236
        } elseif (is_numeric($dateValue)) {
237
            $dateValue += $timezoneAdjustment;
238
            $retValue = self::formattedPHPToExcel(date('Y', $dateValue), date('m', $dateValue), date('d', $dateValue), date('H', $dateValue), date('i', $dateValue), date('s', $dateValue));
239
        } elseif (is_string($dateValue)) {
240
            $retValue = self::stringToExcel($dateValue);
241
        }
242
        date_default_timezone_set($saveTimeZone);
243
244
        return $retValue;
245
    }
246
247
248
    /**
249
     * formattedPHPToExcel
250
     *
251
     * @param    integer    $year
252
     * @param    integer    $month
253
     * @param    integer    $day
254
     * @param    integer    $hours
255
     * @param    integer    $minutes
256
     * @param    integer    $seconds
257
     * @return   integer    Excel date/time value
258
     */
259
    public static function formattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0)
260
    {
261
        if (self::$excelCalendar == self::CALENDAR_WINDOWS_1900) {
262
            //
263
            //    Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel
264
            //    This affects every date following 28th February 1900
265
            //
266
            $excel1900isLeapYear = true;
267
            if (($year == 1900) && ($month <= 2)) {
268
                $excel1900isLeapYear = false;
269
            }
270
            $myexcelBaseDate = 2415020;
271
        } else {
272
            $myexcelBaseDate = 2416481;
273
            $excel1900isLeapYear = false;
274
        }
275
276
        //    Julian base date Adjustment
277
        if ($month > 2) {
278
            $month -= 3;
279
        } else {
280
            $month += 9;
281
            --$year;
282
        }
283
284
        //    Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
285
        $century = substr($year, 0, 2);
286
        $decade = substr($year, 2, 2);
287
        $excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myexcelBaseDate + $excel1900isLeapYear;
288
289
        $excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
290
291
        return (float) $excelDate + $excelTime;
292
    }
293
294
295
    /**
296
     * Is a given cell a date/time?
297
     *
298
     * @param   \PHPExcel\Cell    $pCell
299
     * @return  boolean
300
     */
301
    public static function isDateTime(\PHPExcel\Cell $pCell)
302
    {
303
        return self::isDateTimeFormat(
304
            $pCell->getWorksheet()->getStyle(
305
                $pCell->getCoordinate()
306
            )->getNumberFormat()
307
        );
308
    }
309
310
311
    /**
312
     * Is a given number format a date/time?
313
     *
314
     * @param   \PHPExcel\Style\NumberFormat    $pFormat
315
     * @return  boolean
316
     */
317
    public static function isDateTimeFormat(\PHPExcel\Style\NumberFormat $pFormat)
318
    {
319
        return self::isDateTimeFormatCode($pFormat->getFormatCode());
320
    }
321
322
323
    private static $possibleDateFormatCharacters = 'eymdHs';
324
325
    /**
326
     * Is a given number format code a date/time?
327
     *
328
     * @param     string    $pFormatCode
329
     * @return     boolean
330
     */
331
    public static function isDateTimeFormatCode($pFormatCode = '')
332
    {
333
        if (strtolower($pFormatCode) === strtolower(\PHPExcel\Style\NumberFormat::FORMAT_GENERAL)) {
334
            //    "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
335
            return false;
336
        }
337
        if (preg_match('/[0#]E[+-]0/i', $pFormatCode)) {
338
            //    Scientific format
339
            return false;
340
        }
341
342
        // Switch on formatcode
343
        switch ($pFormatCode) {
344
            //    Explicitly defined date formats
345
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD:
346
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2:
347
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DDMMYYYY:
348
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DMYSLASH:
349
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DMYMINUS:
350
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DMMINUS:
351
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_MYMINUS:
352
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_DATETIME:
353
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME1:
354
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME2:
355
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME3:
356
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME4:
357
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME5:
358
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME6:
359
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME7:
360
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME8:
361
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDDSLASH:
362
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX14:
363
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX15:
364
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX16:
365
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX17:
366
            case \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX22:
367
                return true;
368
        }
369
370
        //    Typically number, currency or accounting (or occasionally fraction) formats
371
        if ((substr($pFormatCode, 0, 1) == '_') || (substr($pFormatCode, 0, 2) == '0 ')) {
372
            return false;
373
        }
374
        // Try checking for any of the date formatting characters that don't appear within square braces
375
        if (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i', $pFormatCode)) {
376
            //    We might also have a format mask containing quoted strings...
377
            //        we don't want to test for any of our characters within the quoted blocks
378
            if (strpos($pFormatCode, '"') !== false) {
379
                $segMatcher = false;
380
                foreach (explode('"', $pFormatCode) as $subVal) {
381
                    //    Only test in alternate array entries (the non-quoted blocks)
382
                    if (($segMatcher = !$segMatcher) &&
383
                        (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i', $subVal))) {
384
                        return true;
385
                    }
386
                }
387
                return false;
388
            }
389
            return true;
390
        }
391
392
        // No date...
393
        return false;
394
    }
395
396
397
    /**
398
     * Convert a date/time string to Excel time
399
     *
400
     * @param    string    $dateValue        Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'
401
     * @return    float|FALSE        Excel date/time serial value
402
     */
403
    public static function stringToExcel($dateValue = '')
404
    {
405
        if (strlen($dateValue) < 2) {
406
            return false;
407
        }
408
        if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue)) {
409
            return false;
410
        }
411
412
        $dateValueNew = \PHPExcel\Calculation\DateTime::DATEVALUE($dateValue);
413
414
        if ($dateValueNew === \PHPExcel\Calculation\Functions::VALUE()) {
415
            return false;
416
        }
417
418 View Code Duplication
        if (strpos($dateValue, ':') !== false) {
0 ignored issues
show
Duplication introduced by
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.

Loading history...
419
            $timeValue = \PHPExcel\Calculation\DateTime::TIMEVALUE($dateValue);
420
            if ($timeValue === \PHPExcel\Calculation\Functions::VALUE()) {
421
                return false;
422
            }
423
            $dateValueNew += $timeValue;
424
        }
425
        return $dateValueNew;
426
    }
427
428
    /**
429
     * Converts a month name (either a long or a short name) to a month number
430
     *
431
     * @param     string    $month    Month name or abbreviation
432
     * @return    integer|string     Month number (1 - 12), or the original string argument if it isn't a valid month name
433
     */
434
    public static function monthStringToNumber($month)
435
    {
436
        $monthIndex = 1;
437
        foreach (self::$monthNames as $shortMonthName => $longMonthName) {
438
            if (($month === $longMonthName) || ($month === $shortMonthName)) {
0 ignored issues
show
Unused Code Bug introduced by
The strict comparison === seems to always evaluate to false as the types of $month (string) and $shortMonthName (integer) can never be identical. Maybe you want to use a loose comparison == instead?
Loading history...
439
                return $monthIndex;
440
            }
441
            ++$monthIndex;
442
        }
443
        return $month;
444
    }
445
446
    /**
447
     * Strips an ordinal froma numeric value
448
     *
449
     * @param     string    $day      Day number with an ordinal
450
     * @return    integer|string      The integer value with any ordinal stripped, or the original string argument if it isn't a valid numeric
451
     */
452
    public static function dayStringToNumber($day)
453
    {
454
        $strippedDayValue = (str_replace(self::$numberSuffixes, '', $day));
455
        if (is_numeric($strippedDayValue)) {
456
            return (integer) $strippedDayValue;
457
        }
458
        return $day;
459
    }
460
}
461