| Total Complexity | 5 |
| Total Lines | 79 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | abstract class AbstractElement implements \JsonSerializable |
||
| 10 | { |
||
| 11 | use ValidatorTrait; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | protected $title; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var null|string |
||
| 20 | */ |
||
| 21 | protected $subtitle; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var null|string |
||
| 25 | */ |
||
| 26 | protected $imageUrl; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * AbstractElement constructor. |
||
| 30 | * |
||
| 31 | 8 | * @param string $title |
|
| 32 | * |
||
| 33 | 8 | * @throws \InvalidArgumentException |
|
| 34 | */ |
||
| 35 | 8 | public function __construct(string $title) |
|
| 36 | 8 | { |
|
| 37 | $this->isValidString($title, 80); |
||
| 38 | |||
| 39 | $this->title = $title; |
||
| 40 | } |
||
| 41 | 8 | ||
| 42 | /** |
||
| 43 | 8 | * @param mixed $subtitle |
|
| 44 | * |
||
| 45 | 8 | * @throws \InvalidArgumentException |
|
| 46 | 8 | * |
|
| 47 | * @return mixed |
||
| 48 | */ |
||
| 49 | public function setSubtitle(string $subtitle) |
||
| 54 | } |
||
| 55 | 8 | ||
| 56 | 8 | /** |
|
| 57 | * @param mixed $imageUrl |
||
| 58 | * |
||
| 59 | * @throws \InvalidArgumentException |
||
| 60 | * |
||
| 61 | 7 | * @return mixed |
|
| 62 | */ |
||
| 63 | public function setImageUrl(string $imageUrl) |
||
| 64 | 7 | { |
|
| 65 | $this->isValidUrl($imageUrl); |
||
| 66 | |||
| 67 | 7 | $this->imageUrl = $imageUrl; |
|
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @return array |
||
| 72 | */ |
||
| 73 | public function toArray(): array |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @return array |
||
| 84 | */ |
||
| 85 | public function jsonSerialize(): array |
||
| 90 |