How should pass a DomCrawler object as input parameter correctly? "Undefined property: Crawler::$extract "

59 Views Asked by At

When I pass the DomCralwer Object to my helper function:

function extractText(Crawler $crawler, $selector)
{
    $result = $crawler->filter($selector)->extract['_text'];
    return $result ? $result[0] : false;
}

it can not recognize the extract method on it:

Undefined property: Symfony\Component\DomCrawler\Crawler::$extract

Where is my problem? I am quite new to php and symfony.

0

There are 0 best solutions below