Completed
Pull Request — master (#30)
by Romain
02:57 queued 31s
created

Value   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 42
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getValue() 0 4 1
A getEndTime() 0 4 2
1
<?php
2
namespace Kerox\Messenger\Model\Data;
3
4
class Value
5
{
6
7
    /**
8
     * @var int|array
9
     */
10
    protected $value;
11
12
    /**
13
     * @var string
14
     */
15
    protected $endTime;
16
17
    /**
18
     * Value constructor.
19
     *
20
     * @param int $value
21
     * @param string $endTime
22
     */
23 3
    public function __construct($value, string $endTime)
24
    {
25 3
        $this->value = $value;
26 3
        $this->endTime = $endTime;
27 3
    }
28
29
    /**
30
     * @return int|array
31
     */
32 2
    public function getValue()
33
    {
34 2
        return $this->value;
35
    }
36
37
    /**
38
     * @param bool $asDateTime
39
     * @return \DateTime|string
40
     */
41 2
    public function getEndTime(bool $asDateTime = true)
42
    {
43 2
        return ($asDateTime) ? \DateTime::createFromFormat(\DateTime::ISO8601, $this->endTime) : $this->endTime;
44
    }
45
}
46