getCrawler($html)->filter($tag)->html() : $this->getCrawler($html)->html(); } public function getLinks(string $html, array $options = ["tag" => "a", "attr" => "href"]): array { return $this->getCrawler($html)->filter($options["tag"])->each( function (Crawler $node) use (&$options) { return ["anchor" => $node->text(), "href" => $node->attr($options["attr"])]; } ); } public function getImages(string $html, array $options = ["tag" => "img", "attr" => "src"]): array { return $this->getCrawler($html)->filter($options["tag"])->each( function (Crawler $node) use (&$options) { return ["alt" => $node->text(), "src" => $node->attr($options["attr"])]; } ); } }