client = $client; } public function resolve(string $url): Metadata { $res = $this->client->get($url); $html = (string) $res->getBody(); $crawler = new Crawler($html); $infoElement = $crawler->filter('div.post-info'); $metadata = new Metadata(); $metadata->title = $infoElement->filter('h1')->text(); $metadata->description = trim($infoElement->filter('p.summary')->text()); $metadata->tags = array_values(array_diff($infoElement->filter('ul.tags > li.tag > a')->extract('_text'), self::EXCLUDED_TAGS)); return $metadata; } }