1 | <?php |
||
5 | class Post |
||
6 | { |
||
7 | /** |
||
8 | * Post names must be unique. |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | private $name; |
||
13 | |||
14 | /** |
||
15 | * Date with format YYYY-MM-DD. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | private $publishDate; |
||
20 | |||
21 | /** |
||
22 | * @var string|null |
||
23 | */ |
||
24 | private $category; |
||
25 | |||
26 | /** |
||
27 | * @var string[] |
||
28 | */ |
||
29 | private $tags; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $contentFilepath; |
||
35 | |||
36 | /** |
||
37 | * @param string $contentFilepath |
||
38 | * @param string $name |
||
39 | * @param string $publishDate |
||
40 | * @param string $category |
||
41 | * @param string[] $tags |
||
42 | */ |
||
43 | public function __construct($contentFilepath, $name, $publishDate, $category = null, $tags = []) |
||
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getCategory() |
||
68 | |||
69 | /** |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getContentFilepath() |
||
76 | |||
77 | /** |
||
78 | * @return string |
||
79 | */ |
||
80 | public function getName() |
||
81 | { |
||
82 | 1 | return $this->name; |
|
83 | } |
||
84 | |||
85 | /** |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getPublishDate() |
||
92 | |||
93 | /** |
||
94 | * @return string[] |
||
95 | */ |
||
96 | public function getTags() |
||
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getHtml() |
||
111 | } |
||
112 |