tagName) !== 'object') { return null; } // Object can have title attribute if ($element->hasAttribute('title') && trim($element->getAttribute('title')) !== '') { return null; } // Or object can contain fallback text content. // We clean up child tags like or to find actual descriptive text. $text = ''; foreach ($element->childNodes as $child) { if ($child instanceof \DOMText) { $text .= $child->textContent; } elseif ($child instanceof DOMElement) { $tagName = strtolower($child->tagName); if ($tagName !== 'param' && $tagName !== 'embed') { $text .= $child->textContent; } } } if (trim($text) === '') { return $this->createViolation( $element, $this->getDescription(), 'Add fallback text inside the element or provide a descriptive title attribute.' ); } return null; } }