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

DateValue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getValue() 0 8 2
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
}