Commit | Line | Data |
---|---|---|
86b8d9ed JC |
1 | <?php |
2 | ||
3 | const DATE_FORM = 'mdY'; | |
4 | ||
5 | function findChildWithClass(/** iterable */ $children, string $class)/**: array*/ { | |
6 | if ($children instanceof Traversable) { | |
7 | $children = iterator_to_array($children); | |
8 | } | |
9 | return array_filter( | |
10 | $children, | |
11 | function($child) use ($class) { | |
12 | return $child->hasAttributes() | |
13 | && $child->attributes->getNamedItem('class')->value == $class; | |
14 | } | |
15 | ); | |
16 | } |