Completed
Push — master ( af9880...c194aa )
by Tristan
02:05
created

ArrayBag::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
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