Total Complexity | 6 |
Total Lines | 86 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
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 | 6 | public function __construct($namespace = self::NS_WSSU) |
|
32 | { |
||
33 | 6 | parent::__construct(self::NAME, $namespace); |
|
34 | 6 | } |
|
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 | 6 | protected function __toSend($asDomElement = false) |
|
44 | { |
||
45 | 6 | $this->setValue([ |
|
46 | 6 | $this->getCreated(), |
|
47 | 6 | $this->getExpires(), |
|
48 | 3 | ]); |
|
49 | |||
50 | 6 | return parent::__toSend($asDomElement); |
|
|
|||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return Created |
||
55 | */ |
||
56 | 6 | public function getCreated() |
|
57 | { |
||
58 | 6 | return $this->created; |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * @param Created $created |
||
63 | * |
||
64 | * @return Timestamp |
||
65 | */ |
||
66 | 6 | public function setCreated(Created $created) |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return Expires |
||
75 | */ |
||
76 | 6 | public function getExpires() |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * @param Expires $expires |
||
83 | * |
||
84 | * @return Expires |
||
85 | */ |
||
86 | 6 | public function setExpires(Expires $expires) |
|
91 | } |
||
92 | } |
||
93 |