Total Complexity | 6 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | final class Avatar |
||
7 | { |
||
8 | /** @var string */ |
||
9 | private $content; |
||
10 | |||
11 | /** @var string */ |
||
12 | private $mimeType; |
||
13 | |||
14 | public function __construct(string $data, string $mimeType) |
||
15 | { |
||
16 | $this->content = $data; |
||
17 | $this->mimeType = $mimeType; |
||
18 | } |
||
19 | |||
20 | public function image(): string |
||
21 | { |
||
22 | return $this->content; |
||
23 | } |
||
24 | |||
25 | public function imageBase64(): string |
||
26 | { |
||
27 | return base64_encode($this->content); |
||
28 | } |
||
29 | |||
30 | public function mimeType(): string |
||
31 | { |
||
32 | return $this->mimeType; |
||
33 | } |
||
34 | |||
35 | public function toHtml(array $attributes = []): string |
||
49 | ); |
||
50 | } |
||
51 | } |
||
52 |