Total Complexity | 5 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | final class Description |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $subject; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | private $text; |
||
25 | |||
26 | /** |
||
27 | * @param string $subject |
||
28 | * @param string $text |
||
29 | * |
||
30 | * @throws InvalidDescriptionException |
||
31 | */ |
||
32 | public function __construct(string $subject, string $text) |
||
33 | { |
||
34 | $subject = trim($subject); |
||
35 | |||
36 | if (empty($subject)) { |
||
37 | throw InvalidDescriptionException::emptySubject(); |
||
38 | } |
||
39 | |||
40 | $text = trim($text); |
||
41 | |||
42 | if (empty($text)) { |
||
43 | throw InvalidDescriptionException::emptyText(); |
||
44 | } |
||
45 | |||
46 | $this->subject = $subject; |
||
47 | $this->text = $text; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return string |
||
52 | */ |
||
53 | public function getText(): string |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | public function getSubject(): string |
||
64 | } |
||
65 | } |
||
66 |