Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
Image
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 src
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 alt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 width
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 height
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Epic64\Elem\Elements;
6
7use Epic64\Elem\Element;
8
9class Image extends Element
10{
11    public function __construct(string $src, string $alt = '')
12    {
13        parent::__construct('img');
14        $this->element->setAttribute('src', $src);
15        $this->element->setAttribute('alt', $alt);
16    }
17
18    public function src(string $src): static
19    {
20        return $this->attr('src', $src);
21    }
22
23    public function alt(string $alt): static
24    {
25        return $this->attr('alt', $alt);
26    }
27
28    public function width(int $width): static
29    {
30        return $this->attr('width', (string)$width);
31    }
32
33    public function height(int $height): static
34    {
35        return $this->attr('height', (string)$height);
36    }
37}