Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
32 | public function __construct(string $imageUrl, string $altText, string $title = '') |
||
33 | { |
||
34 | if (\strlen($imageUrl) > 3000) { |
||
35 | throw new \InvalidArgumentException('$imageUrl too long!'); |
||
36 | } |
||
37 | if (\strlen($altText) > 2000) { |
||
38 | throw new \InvalidArgumentException('$altText too long!'); |
||
39 | } |
||
40 | if (\strlen($title) > 2000) { |
||
41 | throw new \InvalidArgumentException('$altText too long!'); |
||
42 | } |
||
43 | |||
44 | $this->type = MessageTypeEnum::BLOCK_IMAGE; |
||
45 | $this->imageUrl = $imageUrl; |
||
46 | $this->altText = $altText; |
||
47 | if ('' !== $title) { |
||
48 | $this->title = new PlainTextElement($title); |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 |