Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active Jun 27, 2021
Embed
What would you like to do?
<?
private function removeDuplicates(array $patternsWithPossibleDuplicates): array {
return array_intersect_key(
$patternsWithPossibleDuplicates,
array_unique(
array_map("strtolower", $patternsWithPossibleDuplicates)));
}
function simplify(array $patterns): array {
$patternsWithoutDuplicates = $this->removeDuplicates($patterns);
return array_values(array_filter($patternsWithoutDuplicates,
fn ($outerPattern) => $this->alreadyIncludesPattern($patternsWithoutDuplicates, $outerPattern)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment