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

ArrayBag::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

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