public function getCSSSelector()

in src/Facebook/InstantArticles/Transformer/Warnings/Warning.php [45:63]


    public function getCSSSelector()
    {
        if ($this->node) {
            if (Type::is($this->node, 'DOMElement')) {
                $id = $this->node->getAttribute('id');
                if ($id) {
                    return "#$id";
                }
                $class = $this->node->getAttribute('class');
                if ($class) {
                    return $this->node->nodeName . "." . str_replace(" ", ".", $class);
                }
            }
            if (!Type::is($this->node, 'DOMText')) {
                return $this->node->nodeName;
            }
        }
        return '';
    }