Timestamp::getExpires()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WsdlToPhp\WsSecurity;
6
7
use DOMElement;
8
9
class Timestamp extends Element
10
{
11
    public const NAME = 'Timestamp';
12
13
    protected ?Created $created;
14
15
    protected ?Expires $expires;
16
17 2
    public function __construct(string $namespace = self::NS_WSU)
18
    {
19 2
        parent::__construct(self::NAME, $namespace);
20
    }
21
22
    /**
23
     * Overrides method in order to add created and expires values if they are set.
24
     *
25
     * @param bool $asDomElement returns elements as a DOMElement or as a string
26
     *
27
     * @return DOMElement|false|string
28
     */
29 2
    protected function __toSend(bool $asDomElement = false)
30
    {
31 2
        $this->setValue([
32 2
            $this->getCreated(),
33 2
            $this->getExpires(),
34
        ]);
35
36 2
        return parent::__toSend($asDomElement);
37
    }
38
39 2
    public function getCreated(): ?Created
40
    {
41 2
        return $this->created;
42
    }
43
44 2
    public function setCreated(Created $created): self
45
    {
46 2
        $this->created = $created;
47
48 2
        return $this;
49
    }
50
51 2
    public function getExpires(): ?Expires
52
    {
53 2
        return $this->expires;
54
    }
55
56 2
    public function setExpires(Expires $expires): self
57
    {
58 2
        $this->expires = $expires;
59
60 2
        return $this;
61
    }
62
}
63