DateTimeIntervalPoint   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 31
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A value() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
/**
4
 * GpsLab component.
5
 *
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2016, Peter Gribanov
8
 * @license   http://opensource.org/licenses/MIT
9
 */
10
11
namespace GpsLab\Component\Interval\DateTime;
12
13
use GpsLab\Component\Interval\BaseIntervalPoint;
14
15
class DateTimeIntervalPoint extends BaseIntervalPoint
16
{
17
    /**
18
     * @var \DateTime
19
     */
20
    private $date;
21
22
    /**
23
     * @param \DateTime $date
24
     */
25 4
    public function __construct(\DateTime $date)
26
    {
27 4
        $this->date = clone $date;
28 4
    }
29
30
    /**
31
     * @return \DateTime
32
     */
33 4
    public function value()
34
    {
35 4
        return clone $this->date;
36
    }
37
38
    /**
39
     * @return string
40
     */
41 1
    public function __toString()
42
    {
43 1
        return $this->value()->format('Y-m-d H:i:s');
44
    }
45
}
46