-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTime.php
More file actions
44 lines (33 loc) · 1.2 KB
/
Time.php
File metadata and controls
44 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Onimla\HTML;
class Time extends Element {
public function __construct($text = FALSE, $datetime = FALSE) {
self::log('Construct of ' . get_class($this) . ' called.', TRUE);
parent::__construct('time');
self::log('Setting datetime attribute.');
$this->dateTime($datetime);
self::log('Setting text.');
$this->text($text);
self::log('Setting closing tag.');
$this->selfClose(FALSE);
self::log('End of ' . __METHOD__ . ' reached.');
}
/**
* Get or set <code>datetime</code> attribute
* @param string $value optional
* @return \Onimla\HTML\Time|Attribute
*/
public function dateTime($value = FALSE) {
$attrName = 'datetime';
self::log('Getting or setting datetime attribute for ' . get_class($this), TRUE);
if (strlen($value) < 5) {
self::log('Value passed is invalid, returning old value.');
self::log('$value = ' . var_export($value, TRUE));
return $this->getAttributeValue($attrName);
}
$attr = new Attribute($attrName, $value);
$attr->setOutput('encode');
$this->attr($attr);
return $this;
}
}