Timestamp   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 15
c 1
b 0
f 0
dl 0
loc 52
ccs 17
cts 17
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setCreated() 0 5 1
A __construct() 0 3 1
A getExpires() 0 3 1
A __toSend() 0 8 1
A setExpires() 0 5 1
A getCreated() 0 3 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