Passed
Push — master ( b34d93...aea763 )
by Thierry
03:02 queued 24s
created

DataBagContext::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Jaxon\Plugin\Response\DataBag;
4
5
class DataBagContext
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class DataBagContext
Loading history...
6
{
7
    /**
8
     * @var DataBag
9
     */
10
    protected $xDataBag;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
11
12
    /**
13
     * @var string
14
     */
15
    protected $sName;
16
17
    /**
18
     * The constructor
19
     *
20
     * @param DataBag $xDataBag
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
21
     * @param string $sName
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
22
     */
23
    public function __construct(DataBag $xDataBag, string $sName)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
24
    {
25
        $this->xDataBag = $xDataBag;
26
        $this->sName = $sName;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
27
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
28
29
    /**
30
     * @param string $sKey
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
31
     * @param mixed $xValue
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
32
     *
33
     * @return void
34
     */
35
    public function set(string $sKey, $xValue)
36
    {
37
        $this->xDataBag->set($this->sName, $sKey, $xValue);
38
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
39
40
    /**
41
     * @param string $sKey
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
42
     * @param mixed $xValue
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
43
     *
44
     * @return mixed
45
     */
46
    public function get(string $sKey, $xValue = null)
47
    {
48
        return $this->xDataBag->get($this->sName, $sKey, $xValue);
49
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
50
}
51