Passed
Push — master ( 888408...eb1365 )
by Thierry
02:11
created

DataBagContext   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 3 1
A __construct() 0 4 1
A get() 0 3 1
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 DataBagContext
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class DataBagContext
Loading history...
9
{
10
    /**
11
     * @var DataBag
12
     */
13
    protected $xDataBag;
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 $sName;
19
20
    /**
21
     * The constructor
22
     *
23
     * @param DataBag $xDataBag
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
24
     * @param string $sName
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...
25
     */
26
    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...
27
    {
28
        $this->xDataBag = $xDataBag;
29
        $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...
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
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
35
     *
36
     * @return void
37
     */
38
    public function set(string $sKey, $xValue)
39
    {
40
        $this->xDataBag->set($this->sName, $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(string $sKey, $xValue = null)
50
    {
51
        return $this->xDataBag->get($this->sName, $sKey, $xValue);
52
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
53
}
54