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