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

        $pattern = $this->getEscapedPattern($this->text);

        foreach ($elements as $element) {
            $element = new Crawler($element);

            if (preg_match("/$pattern/i", $element->html())) {
                return true;
            }
        }

        return false;
    }
public function matches($crawler): bool
    {
        $elements = $this->crawler($crawler)->filter($this->element);

        $pattern = $this->getEscapedPattern($this->text);

        foreach ($elements as $element) {
            $element = new Crawler($element);

            if (preg_match("/$pattern/i", $element->html())) {
                return true;
            }
        }

        return false;
    }
public function matches ( $ crawler ) : bool { $ elements = $ this -> crawler ( $ crawler ) -> filter ( $ this -> element ) ; $ pattern = $ this -> getEscapedPattern ( $ this -> text ) ; foreach ( $ elements as $ element ) { $ element = new Crawler ( $ element ) ; if ( preg_match ( "/$pattern/i" , $ element -> html ( ) ) ) { return true ; } } return false ; }
Check if the source or text is found within the element in the given crawler.

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