class FighterScraper (View source)

The FighterScraper class is responsible for scraping fighter details from a given URL and returning a FighterDTO.

It uses an HTTP client to fetch the HTML content and a parser to extract the relevant information.

Example usage: $httpClient = new DefaultHttpClient(); $parser = new ParseFighter(); $scraper = new FighterScraper($httpClient, $parser); $fighterDTO = $scraper->scrape('https://www.blackcombat.com/fighter/123'); // $fighterDTO will contain the scraped fighter details

Methods

__construct(HttpClientInterface $http, ParseFighter $parser)

FighterScraper constructor.

scrape(string $url)

Scrape fighter details from the given URL and return a FighterDTO.

Details

__construct(HttpClientInterface $http, ParseFighter $parser)

FighterScraper constructor.

Parameters

HttpClientInterface $http

An HTTP client for fetching HTML content.

ParseFighter $parser

A parser for extracting fighter details from HTML.

FighterDTO scrape(string $url)

Scrape fighter details from the given URL and return a FighterDTO.

Parameters

string $url

The URL of the fighter page to scrape.

Return Value

FighterDTO

The scraped fighter details as a FighterDTO.