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->scrapeById(123); // $fighterDTO will contain the scraped fighter details for the fighter with ID 123

Methods

__construct(HttpClientInterface $http, ParseFighter $parser)

FighterScraper constructor.

scrapeById(int $id)

Scrape fighter details by Sherdog ID 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 scrapeById(int $id)

Scrape fighter details by Sherdog ID and return a FighterDTO.

Parameters

int $id

The Sherdog ID of the fighter to scrape.

Return Value

FighterDTO

The scraped fighter details as a FighterDTO.