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

DateValue::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 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
}