FightDeduplicator
class FightDeduplicator (View source)
The FightDeduplicator is responsible for deduplicating a list of FightDTOs by grouping them based on their similarity and merging them using a FightAggregator.
The group function groups fights that are considered the same based on the FightAggregator's isSameFight method. The deduplicate function merges each group of similar fights into a single FightDTO using the FightAggregator's merge method.
Example usage: $agg = new FightAggregator(new FighterAggregator()); $dedup = new FightDeduplicator($agg); $fights = [...]; // An array of FightDTOs $result = $dedup->deduplicate($fights); // $result will contain deduplicated and merged FightDTOs
Methods
Constructs a new FightDeduplicator with a FightAggregator dependency.
Groups fights that are considered the same based on the FightAggregator's isSameFight method.
Deduplicates a list of FightDTOs by grouping them based on their similarity and merging them using a FightAggregator.
Details
__construct(FightAggregator $aggregator)
Constructs a new FightDeduplicator with a FightAggregator dependency.
array
group(array $fights)
Groups fights that are considered the same based on the FightAggregator's isSameFight method.
array
deduplicate(array $fights)
Deduplicates a list of FightDTOs by grouping them based on their similarity and merging them using a FightAggregator.