Conditions | 8 |
Paths | 3 |
Total Lines | 24 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function itemFromDomElement(DOMElement $element): ?HolidayIteratorItemInterface |
||
22 | { |
||
23 | if ($element->nodeName !== 'date') { |
||
24 | return null; |
||
25 | } |
||
26 | |||
27 | $day = CalendarDayFactory::createCalendarDay( |
||
28 | (int) $element->getAttribute('day'), |
||
29 | (int) $element->getAttribute('month'), |
||
30 | ($element->hasAttribute('calendar') ? $element->getAttribute('calendar') : 'gregorian') |
||
31 | ); |
||
32 | |||
33 | if ($element->hasAttribute('year')) { |
||
34 | $day->setYear((int) $element->getAttribute('year')); |
||
35 | } |
||
36 | |||
37 | return new Date( |
||
38 | $element->textContent, |
||
39 | $element->getAttribute('free') === "true", |
||
40 | $day, |
||
41 | $element->hasAttribute('forwardto') ? $element->getAttribute('forwardto') : '', |
||
42 | $element->hasAttribute('forwardwhen') ? explode(' ', $element->getAttribute('forwardwhen')) : [], |
||
43 | $element->hasAttribute('rewindto') ? $element->getAttribute('rewindto') : '', |
||
44 | $element->hasAttribute('rewindwhen') ? explode(' ', $element->getAttribute('rewindwhen')) : [], |
||
45 | ); |
||
48 |