Completed
Push — feature/issue-7 ( ac92bc...9d75a7 )
by Mikaël
03:43 queued 11s
created

Timestamp::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace WsdlToPhp\WsSecurity;
4
5
class Timestamp extends Element
6
{
7
    /**
8
     * Element name.
9
     *
10
     * @var string
11
     */
12
    const NAME = 'Timestamp';
13
    /**
14
     * Created element.
15
     *
16
     * @var Created
17
     */
18
    protected $created;
19
    /**
20
     * Created element.
21
     *
22
     * @var Expires
23
     */
24
    protected $expires;
25
26
    /**
27
     * Constructor for Timestamp element.
28
     *
29
     * @param string $namespace the namespace
30
     */
31
    public function __construct($namespace = self::NS_WSSU)
32
    {
33
        parent::__construct(self::NAME, $namespace);
34
    }
35
36
    /**
37
     * Overrides method in order to add created and expires values if they are set.
38
     *
39
     * @param bool $asDomElement returns elements as a DOMElement or as a string
40
     *
41
     * @return string
42
     */
43
    protected function __toSend($asDomElement = false)
44
    {
45
        $this->setValue([
46
            $this->getCreated(),
47
            $this->getExpires(),
48
        ]);
49
50
        return parent::__toSend($asDomElement);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::__toSend($asDomElement) also could return the type DOMElement which is incompatible with the documented return type string.
Loading history...
51
    }
52
53
    /**
54
     * @return Created
55
     */
56
    public function getCreated()
57
    {
58
        return $this->created;
59
    }
60
61
    /**
62
     * @param Created $created
63
     *
64
     * @return Timestamp
65
     */
66
    public function setCreated(Created $created)
67
    {
68
        $this->created = $created;
69
70
        return $this;
71
    }
72
73
    /**
74
     * @return Expires
75
     */
76
    public function getExpires()
77
    {
78
        return $this->expires;
79
    }
80
81
    /**
82
     * @param Expires $expires
83
     *
84
     * @return Expires
85
     */
86
    public function setExpires(Expires $expires)
87
    {
88
        $this->expires = $expires;
89
90
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type WsdlToPhp\WsSecurity\Timestamp which is incompatible with the documented return type WsdlToPhp\WsSecurity\Expires.
Loading history...
91
    }
92
}
93