Code Duplication    Length = 7-7 lines in 2 locations

lib/Api/Addon.php 1 location

@@ 39-45 (lines=7) @@
36
            $this->saveToCache($cacheKey, $hit);
37
        }
38
39
        foreach ($filters as $key => $filter) {
40
            if (array_key_exists($key, current($hit))) {
41
                $hit = array_filter($hit, function ($element) use ($key, $filter) {
42
                    return $element[$key] == $filter;
43
                });
44
            }
45
        }
46
47
        return $hit;
48
    }

lib/Api/Plan.php 1 location

@@ 126-132 (lines=7) @@
123
     */
124
    public function filterPlans(array $plans, array $filters): array
125
    {
126
        foreach ($filters as $key => $filter) {
127
            if (array_key_exists($key, current($plans))) {
128
                $plans = array_filter($plans, function ($element) use ($key, $filter) {
129
                    return $element[$key] == $filter;
130
                });
131
            }
132
        }
133
134
        return $plans;
135
    }