Image   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 35
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 3
A getEmoji() 0 3 1
A getUrl() 0 3 1
A setUrl() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace League\Emoji\Node;
6
7
class Image extends Node implements EmojiContainerInterface
8
{
9
    /** @var Emoji */
10
    private $emoji;
11
12 30
    public function __construct(string $value, Emoji $emoji, string $url, ?string $alt = null, ?string $title = null)
13
    {
14 30
        parent::__construct($value);
15
16 30
        $this->emoji = $emoji;
17
18 30
        $this->setAttribute('src', $url);
19
20 30
        if ($alt !== null) {
21 18
            $this->setAttribute('alt', $alt);
22
        }
23
24 30
        if ($title !== null) {
25 18
            $this->setAttribute('title', $title);
26
        }
27 30
    }
28
29 6
    public function getEmoji(): Emoji
30
    {
31 6
        return $this->emoji;
32
    }
33
34 9
    public function getUrl(): string
35
    {
36 9
        return (string) $this->getAttribute('src', '');
37
    }
38
39 3
    public function setUrl(string $url): void
40
    {
41 3
        $this->setAttribute('src', $url);
42 3
    }
43
}
44