Code Duplication    Length = 11-13 lines in 2 locations

src/Traits/Buyable.php 2 locations

@@ 161-173 (lines=13) @@
158
        return $this->specs->count() == 1;
159
    }
160
161
    public function setAttribute($key, $value)
162
    {
163
        foreach (['spec', 'buyable'] as $type) {
164
            $attributes = "{$type}Attributes";
165
            $method = "set" . ucfirst($type);
166
            if (in_array($key, $this->{$attributes})) {
167
                $this->{$method}($key, $value);
168
                return $this;
169
            }
170
        }
171
172
        return parent::setAttribute($key, $value);
173
    }
174
175
    public function getAttribute($key)
176
    {
@@ 175-185 (lines=11) @@
172
        return parent::setAttribute($key, $value);
173
    }
174
175
    public function getAttribute($key)
176
    {
177
        foreach (['spec', 'buyable'] as $type) {
178
            $attributes = "{$type}Attributes";
179
            $method = "get" . ucfirst($type);
180
            if (in_array($key, $this->{$attributes})) {
181
                return $this->{$method}($key);
182
            }
183
        }
184
        return parent::getAttribute($key);
185
    }
186
187
    public function isSpecDirty()
188
    {