class FightsScraper (View source)

The FightsScraper class is responsible for scraping fight details from a given URL and returning an array of FightDTOs.

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 ParseFights(); $scraper = new FightsScraper($httpClient, $parser); $fights = $scraper->scrape('https://www.blackcombat.com/event/123/fights'); // $fights will contain an array of FightDTOs with the scraped fight details

Methods

__construct(HttpClientInterface $http, ParseFights $parser)

FightsScraper constructor.

array
scrape(string $url)

Scrape fight details from the given URL and return an array of FightDTOs.

Details

__construct(HttpClientInterface $http, ParseFights $parser)

FightsScraper constructor.

Parameters

HttpClientInterface $http

An HTTP client for fetching HTML content.

ParseFights $parser

A parser for extracting fight details from HTML.

array scrape(string $url)

Scrape fight details from the given URL and return an array of FightDTOs.

Parameters

string $url

The URL of the fights page to scrape.

Return Value

array

An array of FightDTOs with the scraped fight details.