1 | <?php |
||
11 | class Content |
||
12 | { |
||
13 | const TITLE_MIN_LENGTH = 1; |
||
14 | const TITLE_MAX_LENGTH = 60; |
||
15 | |||
16 | const SUMMARY_MIN_LENGTH = 5; |
||
17 | const SUMMARY_MAX_LENGTH = 140; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $summaryText; |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $productDescription; |
||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $title; |
||
31 | |||
32 | /** |
||
33 | * Creates a new instance of a product Content model. |
||
34 | * |
||
35 | * @param string $title A product title (e.g. "Fancy T-Shirt No. 1") |
||
36 | * @param string $summaryText A short description text of a product (e.g. "The first edition of our fancy |
||
37 | * T-Shirt with a unicorn pooping ice cream on the front"; optional) |
||
38 | * @param string $productDescription A full product description text (optional) |
||
39 | * |
||
40 | * @throws ContentException If the summary text is too long |
||
41 | */ |
||
42 | 25 | public function __construct(string $title, string $summaryText = "", string $productDescription = "") |
|
73 | |||
74 | /** |
||
75 | * Get the title of a product (e.g. "Fancy T-Shirt No. 1") |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | 5 | public function getTitle() |
|
83 | |||
84 | /** |
||
85 | * Get a short description text of a product (e.g. "The first edition of our fancy T-Shirt with a unicorn pooping |
||
86 | * ice cream on the front") |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | 6 | public function getSummaryText() |
|
94 | |||
95 | /** |
||
96 | * Get a full product description text |
||
97 | * |
||
98 | * @return string |
||
99 | */ |
||
100 | 6 | public function getProductDescription() |
|
104 | } |