File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -213,8 +213,16 @@ public function setFooters(array $footers) {
213213 * @param array $alignments An array of strings containing column alignments.
214214 */
215215 public function setAlignments (array $ alignments ) {
216+ $ validAlignments = array (Column::ALIGN_LEFT , Column::ALIGN_RIGHT , Column::ALIGN_CENTER );
217+ foreach ($ alignments as $ column => $ alignment ) {
218+ if (!in_array ($ alignment , $ validAlignments , true )) {
219+ throw new \InvalidArgumentException ("Invalid alignment value ' $ alignment' for column ' $ column'. " );
220+ }
221+ if (!in_array ($ column , $ this ->_headers , true )) {
222+ throw new \InvalidArgumentException ("Column ' $ column' does not exist in table headers. " );
223+ }
224+ }
216225 $ this ->_alignments = $ alignments ;
217- //TODO: Implement error if alignment is not valid and field is not valid
218226 }
219227
220228 /**
You can’t perform that action at this time.
0 commit comments