AbstractMutableCollection   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 44
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __set() 0 4 1
A add() 0 4 1
A set() 0 4 1
A removeKey() 0 4 1
A remove() 0 6 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 __set($key, $value)
14
    {
15
        $this->set($key, $value);
16
    }
17
18
    /**
19
     * @inheritdoc
20
     */
21
    public function add($value)
22
    {
23
        $this->values[] = $value;
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function set($key, $value)
30
    {
31
        $this->values[$key] = $value;
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function removeKey($key)
38
    {
39
        unset($this->values[$key]);
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    public function remove($value)
46
    {
47
        foreach (array_keys($this->values, $value, true) as $key) {
48
            unset($this->values[$key]);
49
        }
50
    }
51
}
52