ArrayBag   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 29
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 8 2
A getAll() 0 4 1
A has() 0 5 2
1
<?php
2
3
namespace Enzyme\Axiom\Bags;
4
5
class ArrayBag implements BagInterface
6
{
7
    protected $store;
8
9
    public function __construct(array $store)
10
    {
11
        $this->store = $store;
12
    }
13
14
    public function get($key)
15
    {
16
        if ($this->has($key)) {
17
            return $this->store[$key];
18
        }
19
20
        return null;
21
    }
22
23
    public function getAll()
24
    {
25
        return $this->store;
26
    }
27
28
    public function has($key)
29
    {
30
        return isset($this->store[$key])
31
            && array_key_exists($key, $this->store);
32
    }
33
}
34