DataBagContext::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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