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

DateTimeValue::getValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
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
}