Code Duplication    Length = 12-12 lines in 2 locations

src/ObjectNode.php 2 locations

@@ 16-27 (lines=12) @@
13
     * @param  AttributeNode $attribute
14
     * @return void
15
     */
16
    public function addAttribute(AttributeNode $attribute)
17
    {
18
        $name = $attribute->getName();
19
        if (isset($this->attributes[$name])) {
20
            throw new \InvalidArgumentException(sprintf("There is allready a attribute with this name '%s'!", $name));
21
        }
22
23
        $this->checkAttribute($attribute);
24
        $this->removeAttributeFromParent($attribute);
25
        Document::setProperty($attribute, 'parent', $this);
26
        $this->attributes[$attribute->getName()] = $attribute;
27
    }
28
29
    /**
30
     * @param  AttributeNode $attribute
@@ 93-104 (lines=12) @@
90
     * @param  AbstractElement $node
91
     * @return void
92
     */
93
    public function addNode(AbstractElement $node)
94
    {
95
        $name = $node->getName();
96
        if (isset($this->nodes[$name])) {
97
            throw new \InvalidArgumentException("There is allready a node with this name!");
98
        }
99
100
        $this->checkNode($node);
101
        $this->removeNodeFromParent($node);
102
        Document::setProperty($node, 'parent', $this);
103
        $this->nodes[$node->getName()] = $node;
104
    }
105
106
    /**
107
     * @param  AbstractElement $node