Img::tagName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace hemio\html;
4
5
/**
6
 * The img element represents an image.
7
 *
8
 * @since version 1.0
9
 * @url http://www.w3.org/TR/html5/embedded-content-0.html#the-img-element
10
 */
11
class Img extends Abstract_\ElementEmpty
12
{
13
14
    public function __construct($url = null, $alt = null)
15
    {
16
        if ($url !== null) {
17
            $this->setAttribute('src', $url);
18
        }
19
        if ($alt !== null) {
20
            $this->setAttribute('alt', $alt.' ');
21
        }
22
    }
23
24
    public static function tagName()
25
    {
26
        return 'img';
27
    }
28
}
29