Conditions | 8 |
Paths | 17 |
Total Lines | 39 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function parseDate( TimeValue $dataValue, $isEnd = false ) { |
||
25 | $year = $dataValue->getYear(); |
||
26 | |||
27 | // ISO range is limited to four digits |
||
28 | if ( ( $year > 9999 ) || ( $year < -9998 ) ) { |
||
29 | return ''; |
||
30 | } |
||
31 | |||
32 | $year = number_format( $year, 0, '.', '' ); |
||
33 | $time = str_replace( ':', '', $dataValue->getTimeString( false ) ); |
||
|
|||
34 | |||
35 | // increment by one day, compute date to cover leap years etc. |
||
36 | if ( ( $time == false ) && ( $isEnd ) ) { |
||
37 | $dataValue = DataValueFactory::getInstance()->newDataValueByType( |
||
38 | '_dat', |
||
39 | $dataValue->getWikiValue() . 'T00:00:00-24:00' |
||
40 | ); |
||
41 | } |
||
42 | |||
43 | $month = $dataValue->getMonth(); |
||
44 | |||
45 | if ( strlen( $month ) == 1 ) { |
||
46 | $month = '0' . $month; |
||
47 | } |
||
48 | |||
49 | $day = $dataValue->getDay(); |
||
50 | |||
51 | if ( strlen( $day ) == 1 ) { |
||
52 | $day = '0' . $day; |
||
53 | } |
||
54 | |||
55 | $result = $year . $month . $day; |
||
56 | |||
57 | if ( $time != false ) { |
||
58 | $result .= "T$time"; |
||
59 | } |
||
60 | |||
61 | return $result; |
||
62 | } |
||
63 | |||
65 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: