Test Setup Failed
Pull Request — latest (#3)
by Mark
31:31
created

Image::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 10
rs 10
cc 2
nc 2
nop 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace UnicornFail\Emoji\Node;
6
7
final class Image extends AbstractStringContainer implements EmojiContainerInterface
8
{
9
    /** @var Emoji */
10
    private $emoji;
11
12
    public function __construct(string $value, Emoji $emoji, string $url, ?string $alt = null)
13
    {
14
        parent::__construct($value);
15
16
        $this->emoji = $emoji;
17
18
        $this->attributes->set('src', $url);
19
20
        if ($alt !== null) {
21
            $this->attributes->set('alt', $alt);
22
        }
23
    }
24
25
    public function getEmoji(): Emoji
26
    {
27
        return $this->emoji;
28
    }
29
30
    public function getUrl(): string
31
    {
32
        return (string) $this->attributes->get('src');
33
    }
34
}
35