1 | <?php |
||
49 | class MetaProperties extends AbstractProperties |
||
50 | { |
||
51 | /** |
||
52 | * Object description |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $_description = ''; |
||
57 | |||
58 | /** |
||
59 | * Object abstract |
||
60 | * |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $_abstract = ''; |
||
64 | |||
65 | /** |
||
66 | * Object keywords |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | protected $_keywords = []; |
||
71 | |||
72 | /** |
||
73 | * Object categories |
||
74 | * |
||
75 | * @var array |
||
76 | */ |
||
77 | protected $_categories = []; |
||
78 | |||
79 | /** |
||
80 | * Object authors |
||
81 | * |
||
82 | * @var AuthorInterface[] |
||
83 | */ |
||
84 | protected $_authors = []; |
||
85 | |||
86 | /** |
||
87 | * Collection name |
||
88 | * |
||
89 | * @var string |
||
90 | */ |
||
91 | const COLLECTION = 'meta'; |
||
92 | |||
93 | /******************************************************************************* |
||
94 | * PUBLIC METHODS |
||
95 | *******************************************************************************/ |
||
96 | |||
97 | /** |
||
98 | * Meta properties constructor |
||
99 | * |
||
100 | * @param array $data Property data |
||
101 | * @param ObjectInterface $object Owner object |
||
102 | */ |
||
103 | 1 | public function __construct(array $data, ObjectInterface $object) |
|
104 | { |
||
105 | 1 | parent::__construct($data, $object); |
|
106 | |||
107 | // Initialize the description |
||
108 | 1 | if (array_key_exists('description', $data)) { |
|
109 | 1 | $this->setDescription($data['description']); |
|
110 | } |
||
111 | |||
112 | // Initialize the abstract |
||
113 | 1 | if (array_key_exists('abstract', $data)) { |
|
114 | 1 | $this->setAbstract($data['abstract']); |
|
115 | } |
||
116 | |||
117 | // Initialize the keywords |
||
118 | 1 | if (array_key_exists('keywords', $data)) { |
|
119 | 1 | $this->setKeywords((array)$data['keywords']); |
|
120 | } |
||
121 | |||
122 | // Initialize the categories |
||
123 | 1 | if (array_key_exists('categories', $data)) { |
|
124 | 1 | $this->setCategories((array)$data['categories']); |
|
125 | } |
||
126 | |||
127 | // Initialize the authors |
||
128 | 1 | if (array_key_exists('authors', $data)) { |
|
129 | 1 | $this->setAuthors($data['authors']); |
|
130 | } |
||
131 | 1 | } |
|
132 | |||
133 | /** |
||
134 | * Return the object description |
||
135 | * |
||
136 | * @return string Object description |
||
137 | */ |
||
138 | public function getDescription() |
||
139 | { |
||
140 | return $this->_description; |
||
141 | } |
||
142 | |||
143 | /** |
||
144 | * Set the object description |
||
145 | * |
||
146 | * @param string $description Object description |
||
147 | * @return MetaProperties Self reference |
||
148 | */ |
||
149 | 1 | public function setDescription($description) |
|
154 | |||
155 | /** |
||
156 | * Return the object abstract |
||
157 | * |
||
158 | * @return string Object abstract |
||
159 | */ |
||
160 | public function getAbstract() |
||
161 | { |
||
162 | return $this->_abstract; |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * Set the object abstract |
||
167 | * |
||
168 | * @param string $abstract Object abstract |
||
169 | * @return MetaProperties Self reference |
||
170 | */ |
||
171 | 1 | public function setAbstract($abstract) |
|
176 | |||
177 | /** |
||
178 | * Return the object keywords |
||
179 | * |
||
180 | * @return array Object keywords |
||
181 | */ |
||
182 | 1 | public function getKeywords() |
|
186 | |||
187 | /** |
||
188 | * Set the object keywords |
||
189 | * |
||
190 | * @param array $keywords Object keywords |
||
191 | * @return MetaProperties Self reference |
||
192 | */ |
||
193 | 1 | public function setKeywords(array $keywords) |
|
199 | |||
200 | /** |
||
201 | * Return the object categories |
||
202 | * |
||
203 | * @return array Object categories |
||
204 | */ |
||
205 | 1 | public function getCategories() |
|
209 | |||
210 | /** |
||
211 | * Set the object categories |
||
212 | * |
||
213 | * @param array $categories Object categories |
||
214 | * @return MetaProperties Self reference |
||
215 | */ |
||
216 | 1 | public function setCategories(array $categories) |
|
222 | |||
223 | /** |
||
224 | * Return the object authors |
||
225 | * |
||
226 | * @return AuthorInterface[] |
||
227 | */ |
||
228 | 1 | public function getAuthors() |
|
232 | |||
233 | /** |
||
234 | * Set the object authors |
||
235 | * |
||
236 | * @param array $authors Object authors |
||
237 | * @return MetaProperties Self reference |
||
238 | * @throws InvalidArgumentException If an author is invalid |
||
239 | */ |
||
240 | 1 | public function setAuthors(array $authors) |
|
269 | } |
||
270 |