src/Constraints/HasElement.php
public function matches($crawler): bool
    {
        $elements = $this->crawler($crawler)->filter($this->selector);

        if ($elements->count() == 0) {
            return false;
        }

        if (empty($this->attributes)) {
            return true;
        }

        $elements = $elements->reduce(function ($element) {
            return $this->hasAttributes($element);
        });

        return $elements->count() > 0;
    }
public function matches($crawler): bool
    {
        $elements = $this->crawler($crawler)->filter($this->selector);

        if ($elements->count() == 0) {
            return false;
        }

        if (empty($this->attributes)) {
            return true;
        }

        $elements = $elements->reduce(function ($element) {
            return $this->hasAttributes($element);
        });

        return $elements->count() > 0;
    }
public function matches ( $ crawler ) : bool { $ elements = $ this -> crawler ( $ crawler ) -> filter ( $ this -> selector ) ; if ( $ elements -> count ( ) == 0 ) { return false ; } if ( empty ( $ this -> attributes ) ) { return true ; } $ elements = $ elements -> reduce ( function ( $ element ) { return $ this -> hasAttributes ( $ element ) ; } ) ; return $ elements -> count ( ) > 0 ; }
Check if the element is found in the given crawler.

@param  \Symfony\Component\DomCrawler\Crawler|string  $crawler
@return bool
Check if the element is found in the given crawler .