SherdogIdResolver
class SherdogIdResolver (View source)
Resolves a Sherdog fighter ID from a list of candidates based on name similarity.
This is used to match a fighter's name to the correct Sherdog ID when multiple candidates are found in search results. The resolver uses a simple string similarity measure to determine the best match, and returns the ID of the best candidate if it exceeds a certain threshold.
Example usage: $resolver = new SherdogIdResolver(); $searchHtml = $searchScraper->search($fighter->name); $candidates = $parser($searchHtml); $sherdogId = $resolver->resolve($fighter->name, $candidates); $fighter->sherdogId = $sherdogId;
Methods
Resolves a Sherdog fighter ID from a list of candidates based on name similarity.
Details
int|null
resolve(string $name, array $candidates)
Resolves a Sherdog fighter ID from a list of candidates based on name similarity.