Completed
Push — master ( c61dd9...791f1f )
by Thierry
01:36
created

AttrGet::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Jaxon\Response\Plugin\Call;
4
5
use JsonSerializable;
6
7
class AttrGet implements JsonSerializable
8
{
9
    /**
10
     * The attribute name
11
     *
12
     * @var string
13
     */
14
    private $sAttrName;
15
16
    /**
17
     * The constructor.
18
     *
19
     * @param string        $sAttrName            The attribute name
20
     */
21
    public function __construct($sAttrName)
22
    {
23
        $this->sAttrName = (string)$sAttrName;
24
    }
25
26
    /**
27
     * Returns a string representation of the script output (javascript) from this call
28
     *
29
     * @return string
30
     */
31
    public function getScript()
32
    {
33
        return $this->sAttrName;
34
    }
35
36
    /**
37
     * Convert this call to string
38
     *
39
     * @return string
40
     */
41
    public function __toString()
42
    {
43
        return $this->getScript();
44
    }
45
46
    /**
47
     * Convert this call to string, when converting the response into json.
48
     *
49
     * This is a method of the JsonSerializable interface.
50
     *
51
     * @return string
52
     */
53
    public function jsonSerialize()
54
    {
55
        return $this->getScript();
56
    }
57
}
58