Total Complexity | 6 |
Total Lines | 95 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | trait ImageTrait |
||
7 | { |
||
8 | /** |
||
9 | * The image URL. |
||
10 | * |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $url; |
||
14 | |||
15 | /** |
||
16 | * The alternative text for the image. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $alt_text; |
||
21 | |||
22 | /** |
||
23 | * The image title. |
||
24 | * |
||
25 | * @var \Maknz\Slack\BlockElement\Text |
||
26 | */ |
||
27 | protected $title; |
||
28 | |||
29 | /** |
||
30 | * Get the image URL. |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | 5 | public function getUrl() |
|
35 | { |
||
36 | 5 | return $this->url; |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * Set the image URL. |
||
41 | * |
||
42 | * @param string $url |
||
43 | * |
||
44 | * @return $this |
||
45 | */ |
||
46 | 6 | public function setUrl($url) |
|
47 | { |
||
48 | 6 | $this->url = $url; |
|
49 | |||
50 | 6 | return $this; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * Get the alternative text for the image. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | 5 | public function getAltText() |
|
59 | { |
||
60 | 5 | return $this->alt_text; |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * Set the alternative text for the image. |
||
65 | * |
||
66 | * @param mixed $text |
||
67 | * |
||
68 | * @return $this |
||
69 | */ |
||
70 | 6 | public function setAltText($text) |
|
71 | { |
||
72 | 6 | $this->alt_text = $text; |
|
73 | |||
74 | 6 | return $this; |
|
75 | } |
||
76 | |||
77 | /** |
||
78 | * Get the image title. |
||
79 | * |
||
80 | * @return \Maknz\Slack\BlockElement\Text |
||
81 | */ |
||
82 | 5 | public function getTitle() |
|
83 | { |
||
84 | 5 | return $this->title; |
|
85 | } |
||
86 | |||
87 | /** |
||
88 | * Set the image title. |
||
89 | * |
||
90 | * @param mixed $title |
||
91 | * |
||
92 | * @return $this |
||
93 | * |
||
94 | * @throws \InvalidArgumentException |
||
95 | */ |
||
96 | 4 | public function setTitle($title) |
|
101 | } |
||
102 | } |
||
103 |