public function __toString()

in src/Facebook/InstantArticles/Transformer/Warnings/UnrecognizedElement.php [34:55]


    public function __toString()
    {
        $reflection = new \ReflectionClass(get_class($this->context));
        $className = $reflection->getShortName();
        if ($this->node) {
            $nodeName = $this->node->nodeName;
        }
        if (substr($nodeName, 0, 1) === '#') {
            $nodeDescription = '"'.mb_strimwidth($this->node->textContent, 0, 30, '...').'"';
        } else {
            $nodeDescription = '<';
            $nodeDescription .= $nodeName;
            if (Type::is($this->node, 'DOMElement')) {
                $class = $this->node->getAttribute('class');
                if ($class) {
                    $nodeDescription .= ' class="'. $class .'"';
                }
            }
            $nodeDescription .= '>';
        }
        return "No rules defined for {$nodeDescription} in the context of $className";
    }