Bag   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 36
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __call() 0 8 2
1
<?php
2
3
namespace Enzyme\Loopy;
4
5
class Bag
6
{
7
    /**
8
     * The internal data store for this bag.
9
     *
10
     * @var array
11
     */
12
    protected $store = [];
13
14
    /**
15
     * Create a new bag with the given store data.
16
     *
17
     * @param array $store The associated data.
18
     */
19
    public function __construct($store)
20
    {
21
        $this->store = $store;
22
    }
23
24
    /**
25
     * Magic method to fetch data from the store.
26
     *
27
     * @param string $name The name of value to fetch.
28
     * @param mixed  $args Associated arguments (ignored).
29
     *
30
     * @return mixed|null The value.
31
     */
32
    public function __call($name, $args)
33
    {
34
        if (array_key_exists($name, $this->store)) {
35
            return $this->store[$name];
36
        }
37
38
        return null;
39
    }
40
}