Time   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
c 2
b 1
f 0
lcom 0
cbo 3
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A tagName() 0 4 1
A __construct() 0 8 1
1
<?php
2
3
namespace hemio\html;
4
5
/**
6
 * The time element represents its contents, along with a machine-readable form
7
 * of those contents in the datetime attribute.
8
 *
9
 * @since version 1.0
10
 * @url http://www.w3.org/TR/html5/text-level-semantics.html#the-time-element
11
 */
12
class Time extends Abstract_\ElementContent
13
{
14
15
    use Trait_\DefaultElementContent;
16
    /**
17
     *
18
     * @var \DateTime
19
     */
20
    protected $time;
21
22
    /**
23
     * @url http://php.net/manual/en/function.strftime.php
24
     * @var string
25
     */
26
    protected $timeFormat;
27
28
    public static function tagName()
29
    {
30
        return 'time';
31
    }
32
33
    public function __construct(\DateTime $time = null, $format = '%x')
34
    {
35
        $this->time       = $time;
36
        $this->timeFormat = $format;
37
38
        $this['_TIME'] = new Str(strftime($this->timeFormat,
39
                                          $this->time->getTimestamp()));
40
    }
41
}
42