Code Duplication    Length = 17-17 lines in 3 locations

src/Attributes.php 3 locations

@@ 215-231 (lines=17) @@
212
     *
213
     * @return $this
214
     */
215
    public function append($key, $value = null)
216
    {
217
        $this->storage += array(
218
            $key => new Attribute(
219
                $key,
220
                $this->ensureString($value)
221
            )
222
        );
223
224
        $value = $this->normalizeValue($value);
225
226
        foreach ($value as $value_item) {
227
            $this->storage[$key]->append($value_item);
228
        }
229
230
        return $this;
231
    }
232
233
    /**
234
     * Remove a value from a specific attribute.
@@ 306-322 (lines=17) @@
303
     *
304
     * @return $this
305
     */
306
    public function replace($key, $value, $replacement)
307
    {
308
        $this->storage += array(
309
            $key => new Attribute(
310
                $key,
311
                $this->ensureString($value)
312
            )
313
        );
314
315
        $replacement = $this->normalizeValue($replacement);
316
317
        foreach ($replacement as $replacement_value) {
318
            $this->storage[$key]->replace($value, $replacement_value);
319
        }
320
321
        return $this;
322
    }
323
324
    /**
325
     * Merge attributes.
@@ 332-348 (lines=17) @@
329
     *
330
     * @return $this
331
     */
332
    public function merge(array $data = array())
333
    {
334
        foreach ($data as $key => $value) {
335
            $this->storage += array(
336
                $key => new Attribute(
337
                    $key,
338
                    $this->ensureString($value)
339
                )
340
            );
341
342
            $this->storage[$key]->merge(
343
                $this->normalizeValue($value)
344
            );
345
        }
346
347
        return $this;
348
    }
349
350
    /**
351
     * Check if an attribute exists and if a value if provided check it as well.