protected function elements($code)
    {
        libxml_use_internal_errors(true);

        $doc = new \DOMDocument;

        $doc->loadHTML((string) $code);

        $tag = (string) $this->tagname;

        $items = $doc->getElementsByTagName($tag);

        $items = iterator_to_array($items);

        return count($items) > 0 ? $items : array();
    }
protected function elements($code)
    {
        libxml_use_internal_errors(true);

        $doc = new \DOMDocument;

        $doc->loadHTML((string) $code);

        $tag = (string) $this->tagname;

        $items = $doc->getElementsByTagName($tag);

        $items = iterator_to_array($items);

        return count($items) > 0 ? $items : array();
    }
protected function elements ( $ code ) { libxml_use_internal_errors ( true ) ; $ doc = new \ DOMDocument ; $ doc -> loadHTML ( ( string ) $ code ) ; $ tag = ( string ) $ this -> tagname ; $ items = $ doc -> getElementsByTagName ( $ tag ) ; $ items = iterator_to_array ( $ items ) ; return count ( $ items ) > 0 ? $ items : array ( ) ; }
Returns elements by a tag name.

@param  string $code
@return \DOMNodeList
Returns elements by a tag name .