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

DatabagContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 55
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A new() 0 3 1
A get() 0 3 1
A set() 0 3 1
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