Passed
Push — main ( 10601e...ca0571 )
by Thierry
04:19
created

DatabagContext::new()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Jaxon\App\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): void
36
    {
37
        $this->xDatabag->set($this->sName, $sKey, $xValue);
38
    }
39
40
    /**
41
     * @param string $sKey
42
     * @param mixed $xValue
43
     *
44
     * @return void
45
     */
46
    public function new(string $sKey, $xValue): void
47
    {
48
        $this->xDatabag->new($this->sName, $sKey, $xValue);
49
    }
50
51
    /**
52
     * @param string $sKey
53
     * @param mixed $xValue
54
     *
55
     * @return mixed
56
     */
57
    public function get(string $sKey, $xValue = null): mixed
58
    {
59
        return $this->xDatabag->get($this->sName, $sKey, $xValue);
60
    }
61
}
62