Code Duplication    Length = 7-7 lines in 3 locations

src/SetterTrait.php 3 locations

@@ 66-72 (lines=7) @@
63
     */
64
    public function setChild($parent, $child)
65
    {
66
        if (is_string($parent)) {
67
            $name   = $parent;
68
            $parent = $this->getItem($parent);
69
            if (is_null($parent)) {
70
                throw new InvalidParamException("Unknown parent:$name at setChild");
71
            }
72
        }
73
        if (is_string($child)) {
74
            $name  = $child;
75
            $child = $this->getItem($child);
@@ 73-79 (lines=7) @@
70
                throw new InvalidParamException("Unknown parent:$name at setChild");
71
            }
72
        }
73
        if (is_string($child)) {
74
            $name  = $child;
75
            $child = $this->getItem($child);
76
            if (is_null($child)) {
77
                throw new InvalidParamException("Unknown child:$name at setChild");
78
            }
79
        }
80
        if (isset($this->children[$parent->name][$child->name])) {
81
            return false;
82
        }
@@ 96-102 (lines=7) @@
93
     */
94
    public function setAssignment($role, $userId)
95
    {
96
        if (is_string($role)) {
97
            $name = $role;
98
            $role = $this->getRole($role);
99
            if (is_null($role)) {
100
                throw new InvalidParamException("Unknown role:$name at setAssignment");
101
            }
102
        }
103
        if (isset($this->assignments[$userId][$role->name])) {
104
            return false;
105
        }