Completed
Push — master ( 5ebe79...868b20 )
by Owen
01:17
created

MutableKeyedCollection::remove()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Mundanity\Collection;
4
5
6
/**
7
 * A mutable keyed collection.
8
 *
9
 */
10
class MutableKeyedCollection extends KeyedCollection implements MutableKeyedCollectionInterface
11
{
12
    use MutableTrait;
13
14
    /**
15
     * {@inheritdoc}
16
     *
17
     */
18
    public function add($key, $item)
19
    {
20
        $this->data[$key] = $item;
21
        return $this;
22
    }
23
24
25
    /**
26
     * {@inheritdoc}
27
     *
28
     */
29
    public function removeByKey($key)
30
    {
31
        if (array_key_exists($key, $this->data)) {
32
            unset($this->data[$key]);
33
        }
34
        return $this;
35
    }
36
}
37