Passed
Push — v5.x ( 6eb5e2...afe246 )
by Thierry
02:28
created

AttrGet::__toString()   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
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Jaxon\Request\Js\Selector;
4
5
use JsonSerializable;
6
7
class AttrGet implements JsonSerializable
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class AttrGet
Loading history...
8
{
9
    /**
10
     * The attribute name
11
     *
12
     * @var string
13
     */
14
    private $sAttrName;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
15
16
    /**
17
     * The constructor.
18
     *
19
     * @param string $sAttrName    The attribute name
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
20
     */
21
    public function __construct(string $sAttrName)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
22
    {
23
        $this->sAttrName = $sAttrName;
24
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
25
26
    /**
27
     * Returns a string representation of the script output (javascript) from this call
28
     *
29
     * @return string
30
     */
31
    public function __toString(): string
32
    {
33
        return '.' . $this->sAttrName;
34
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
35
36
    /**
37
     * Convert this call to array, when converting the response into json.
38
     *
39
     * @return array
40
     */
41
    public function jsonSerialize(): array
42
    {
43
        return [
44
            '_type' => 'attr',
45
            '_name' => $this->sAttrName,
46
        ];
47
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
48
}
49