Code Duplication    Length = 15-15 lines in 2 locations

src/MapHandler.php 2 locations

@@ 66-80 (lines=15) @@
63
        $ret = false;
64
65
        // Remove entry from 'types'.
66
        if (isset($this->map['types'][$type])) {
67
            $key = array_search($extension, $this->map['types'][$type]);
68
            if ($key !== false) {
69
                $ret = true;
70
                unset($this->map['types'][$type][$key]);
71
                $tmp = [];
72
                foreach ($this->map['types'][$type] as $v) {
73
                    $tmp[] = $v;
74
                }
75
                $this->map['types'][$type] = $tmp;
76
                if (empty($this->map['types'][$type])) {
77
                    unset($this->map['types'][$type]);
78
                }
79
            }
80
        }
81
82
        // Remove entry from 'extensions'.
83
        if (isset($this->map['extensions'][$extension])) {
@@ 83-97 (lines=15) @@
80
        }
81
82
        // Remove entry from 'extensions'.
83
        if (isset($this->map['extensions'][$extension])) {
84
            $key = array_search($type, $this->map['extensions'][$extension]);
85
            if ($key !== false) {
86
                $ret = true;
87
                unset($this->map['extensions'][$extension][$key]);
88
                $tmp = [];
89
                foreach ($this->map['extensions'][$extension] as $v) {
90
                    $tmp[] = $v;
91
                }
92
                $this->map['extensions'][$extension] = $tmp;
93
                if (empty($this->map['extensions'][$extension])) {
94
                    unset($this->map['extensions'][$extension]);
95
                }
96
            }
97
        }
98
99
        return $ret;
100
    }