Completed
Push — master ( 1c26be...19bb2d )
by Basil
05:42
created

DateTimeValue::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace luya\web\jsonld;
4
5
/**
6
 * A combination of date and time of day in the form [-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm] (see Chapter 5.4 of ISO 8601).
7
 * 
8
 * @author Basil Suter <[email protected]>
9
 * @since 1.0.3
10
 */
11
class DateTimeValue extends BaseValue
12
{
13
    private $_datetime;
14
    
15
    public function __construct($datetime)
16
    {
17
        $this->_datetime = $datetime;
18
    }
19
    
20
    public function getValue()
21
    {
22
        if (is_numeric($this->_datetime)) {
23
            $this->_datetime = date("c", $this->_datetime);
24
        }
25
        
26
        return $this->_datetime;
27
    }
28
}