Passed
Push — master ( d23948...c73ccc )
by Thierry
02:16
created

Context::get()   A

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
eloc 1
c 1
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\Response\Plugin\DataBag;
4
5
use function is_array;
6
use function array_map;
7
8
class Context
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class Context
Loading history...
9
{
10
    /**
11
     * @var Bag
12
     */
13
    protected $xBag = '';
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
14
15
    /**
16
     * @var string
17
     */
18
    protected $sBagName;
19
20
    /**
21
     * The constructor
22
     *
23
     * @param Bag $xBag
0 ignored issues
show
Coding Style introduced by
Expected 4 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
24
     * @param string $sBagName
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
25
     */
26
    public function __construct(Bag $xBag, $sBagName)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
27
    {
28
        $this->xBag = $xBag;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 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...
29
        $this->sBagName = $sBagName;
30
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
31
32
    /**
33
     * @param string $sKey
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
34
     * @param mixed $xValue
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
35
     *
36
     * @return void
37
     */
38
    public function set($sKey, $xValue)
39
    {
40
        $this->xBag->set($this->sBagName, $sKey, $xValue);
41
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
42
43
    /**
44
     * @param string $sKey
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
45
     * @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...
46
     *
47
     * @return mixed
48
     */
49
    public function get($sKey, $xValue = null)
50
    {
51
        return $this->xBag->get($this->sBagName, $sKey, $xValue);
52
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
53
}
54