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

DateValue::__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 date value in ISO 8601 date format.
7
 * 
8
 * Auto convert timestamp values to iso 8601 date.
9
 * 
10
 * @author Basil Suter <[email protected]>
11
 * @since 1.0.3
12
 */
13
class DateValue extends BaseValue
14
{
15
    private $_date;
16
    
17
    public function __construct($date)
18
    {
19
        $this->_date = $date;
20
    }
21
    
22
    public function getValue()
23
    {
24
        if (is_numeric($this->_date)) {
25
            $this->_date = date("Y-m-d", $this->_date);
26
        }
27
        
28
        return $this->_date;
29
    }
30
}