Code Duplication    Length = 10-12 lines in 2 locations

src/WidgetGroup.php 2 locations

@@ 103-114 (lines=12) @@
100
     *
101
     * @param int $id
102
     */
103
    public function removeById($id)
104
    {
105
        foreach ($this->widgets as $position => $widgets) {
106
            foreach ($widgets as $i => $widget) {
107
                if ($widget['id'] === $id) {
108
                    unset($this->widgets[$position][$i]);
109
110
                    return;
111
                }
112
            }
113
        }
114
    }
115
116
    /**
117
     * Remove all widgets with $name from the group.
@@ 121-130 (lines=10) @@
118
     *
119
     * @param string $name
120
     */
121
    public function removeByName($name)
122
    {
123
        foreach ($this->widgets as $position => $widgets) {
124
            foreach ($widgets as $i => $widget) {
125
                if ($widget['arguments'][0] === $name) {
126
                    unset($this->widgets[$position][$i]);
127
                }
128
            }
129
        }
130
    }
131
132
    /**
133
     * Remove all widgets from $position from the group.