Code Duplication    Length = 9-11 lines in 2 locations

src/Elements/Traits/HasDecoratorsTrait.php 2 locations

@@ 62-70 (lines=9) @@
59
     */
60
    public function getDecorator($name, $position = false)
61
    {
62
        if ($position) {
63
            return $this->_decorators[$position][$name];
64
        } else {
65
            foreach ($this->_decorators as $position => $decorators) {
66
                if (isset($decorators[$name])) {
67
                    return $decorators[$name];
68
                }
69
            }
70
        }
71
72
        return false;
73
    }
@@ 82-92 (lines=11) @@
79
     */
80
    public function removeDecorator($name, $position = false)
81
    {
82
        if ($position) {
83
            unset($this->_decorators[$position][$name]);
84
        } else {
85
            foreach ($this->_decorators as $position => $decorators) {
86
                if (isset($decorators[$name])) {
87
                    unset($decorators[$name]);
88
89
                    return $this;
90
                }
91
            }
92
        }
93
94
        return $this;
95
    }