Completed
Push — master ( 25cc22...c3be57 )
by Eric
05:50
created

AbstractMutableCollection::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Oqq\Minc\Common\Collection;
4
5
/**
6
 * @author Eric Braun <[email protected]>
7
 */
8
abstract class AbstractMutableCollection extends AbstractCollection implements MutableCollectionInterface
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public function add($value)
14
    {
15
        $this->values[] = $value;
16
    }
17
18
    /**
19
     * @inheritdoc
20
     */
21
    public function set($key, $value)
22
    {
23
        $this->values[$key] = $value;
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function removeKey($key)
30
    {
31
        unset($this->values[$key]);
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function remove($value)
38
    {
39
        foreach (array_keys($this->values, $value, true) as $key) {
40
            unset($this->values[$key]);
41
        }
42
    }
43
}
44