DataBagContext   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 44
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 3 1
A __construct() 0 4 1
A get() 0 3 1
1
<?php
2
3
namespace Jaxon\Plugin\Response\DataBag;
4
5
class DataBagContext
6
{
7
    /**
8
     * @var DataBag
9
     */
10
    protected $xDataBag;
11
12
    /**
13
     * @var string
14
     */
15
    protected $sName;
16
17
    /**
18
     * The constructor
19
     *
20
     * @param DataBag $xDataBag
21
     * @param string $sName
22
     */
23
    public function __construct(DataBag $xDataBag, string $sName)
24
    {
25
        $this->xDataBag = $xDataBag;
26
        $this->sName = $sName;
27
    }
28
29
    /**
30
     * @param string $sKey
31
     * @param mixed $xValue
32
     *
33
     * @return void
34
     */
35
    public function set(string $sKey, $xValue)
36
    {
37
        $this->xDataBag->set($this->sName, $sKey, $xValue);
38
    }
39
40
    /**
41
     * @param string $sKey
42
     * @param mixed $xValue
43
     *
44
     * @return mixed
45
     */
46
    public function get(string $sKey, $xValue = null)
47
    {
48
        return $this->xDataBag->get($this->sName, $sKey, $xValue);
49
    }
50
}
51