public function hasSingleTagInsideElement($tag)
    {
        // There should be exactly 1 element child with given tag
        if (count($children = $this->getChildren(true)) !== 1 || $children[0]->nodeName !== $tag) {
            return false;
        }

        // And there should be no text nodes with real content
        return array_reduce($children, function ($carry, $child) {
            if (!$carry === false) {
                return false;
            }

            /* @var DOMNode $child */
            return !($child->nodeType === XML_TEXT_NODE && !preg_match('/\S$/', $child->getTextContent()));
        });
    }