Code Duplication    Length = 14-14 lines in 2 locations

models/AuthItemModel.php 2 locations

@@ 223-236 (lines=14) @@
220
     *
221
     * @return bool
222
     */
223
    public function addChildren(array $items): bool
224
    {
225
        if ($this->_item) {
226
            foreach ($items as $name) {
227
                $child = $this->manager->getPermission($name);
228
                if (empty($child) && $this->type == Item::TYPE_ROLE) {
229
                    $child = $this->manager->getRole($name);
230
                }
231
                $this->manager->addChild($this->_item, $child);
232
            }
233
        }
234
235
        return true;
236
    }
237
238
    /**
239
     * Remove child from an item
@@ 245-258 (lines=14) @@
242
     *
243
     * @return bool
244
     */
245
    public function removeChildren(array $items): bool
246
    {
247
        if ($this->_item !== null) {
248
            foreach ($items as $name) {
249
                $child = $this->manager->getPermission($name);
250
                if (empty($child) && $this->type == Item::TYPE_ROLE) {
251
                    $child = $this->manager->getRole($name);
252
                }
253
                $this->manager->removeChild($this->_item, $child);
254
            }
255
        }
256
257
        return true;
258
    }
259
260
    /**
261
     * Get all available and assigned roles, permission and routes