ArrayBag::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
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