@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param mixed[] $data table cell data. |
35 | 35 | * @param mixed[] $columnSpecs table columns cell settings. |
36 | 36 | */ |
37 | - public function __construct($tableSpecs = [], $data = [], $columnSpecs = []) |
|
37 | + public function __construct($tableSpecs = [ ], $data = [ ], $columnSpecs = [ ]) |
|
38 | 38 | { |
39 | 39 | $this->create($tableSpecs, $data, $columnSpecs); |
40 | 40 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return object the html table object. |
54 | 54 | */ |
55 | - public function create($tableSpecs = [], $data = [], $columnSpecs = []) |
|
55 | + public function create($tableSpecs = [ ], $data = [ ], $columnSpecs = [ ]) |
|
56 | 56 | { |
57 | 57 | $this->resetTableTags(); |
58 | 58 | $this->setTableSpecifications($tableSpecs); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function isClassPresent($tableSpec) |
116 | 116 | { |
117 | - return isset($tableSpec['class']) ? true : false; |
|
117 | + return isset($tableSpec[ 'class' ]) ? true : false; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return string[] the table specification without the CSS id tag. |
128 | 128 | */ |
129 | 129 | private function removeId($tableSpec) { |
130 | - $tableSpec['id'] = null; |
|
130 | + $tableSpec[ 'id' ] = null; |
|
131 | 131 | |
132 | 132 | return $tableSpec; |
133 | 133 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | private function setColumnTitlesFromData($data) |
175 | 175 | { |
176 | - $firstRow = isset($data[0]) ? $data[0] : []; |
|
176 | + $firstRow = isset($data[ 0 ]) ? $data[ 0 ] : [ ]; |
|
177 | 177 | foreach ($firstRow as $key => $value) { |
178 | 178 | $this->tableHead .= "\n<th>"; |
179 | 179 | $this->tableHead .= $key; |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | private function isTableFooter($columnSpec) |
216 | 216 | { |
217 | 217 | $isFooter = false; |
218 | - if (isset($columnSpec['type'])) { |
|
219 | - if (strcmp($columnSpec['type'], self::FOOTER) === 0) { |
|
218 | + if (isset($columnSpec[ 'type' ])) { |
|
219 | + if (strcmp($columnSpec[ 'type' ], self::FOOTER) === 0) { |
|
220 | 220 | $isFooter = true; |
221 | 221 | } |
222 | 222 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | private function getTitle($key, $columnSpec) |
242 | 242 | { |
243 | - return isset($columnSpec['title']) ? $columnSpec['title'] : $key; |
|
243 | + return isset($columnSpec[ 'title' ]) ? $columnSpec[ 'title' ] : $key; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | private function getColspan($columnSpec) |
343 | 343 | { |
344 | - return isset($columnSpec['colspan']) ? " colspan='{$columnSpec['colspan']}'" : null; |
|
344 | + return isset($columnSpec[ 'colspan' ]) ? " colspan='{$columnSpec[ 'colspan' ]}'" : null; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | */ |
386 | 386 | private function isFunctionSpecified($columnSpec) |
387 | 387 | { |
388 | - return isset($columnSpec['function']) ? true : false; |
|
388 | + return isset($columnSpec[ 'function' ]) ? true : false; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | */ |
419 | 419 | private function getValueThroughFunction($columnSpec, $dataValue) |
420 | 420 | { |
421 | - if (!empty($columnSpec['function'])) { |
|
422 | - return call_user_func($columnSpec['function'], $dataValue); |
|
421 | + if (!empty($columnSpec[ 'function' ])) { |
|
422 | + return call_user_func($columnSpec[ 'function' ], $dataValue); |
|
423 | 423 | } else { |
424 | 424 | return $dataValue; |
425 | 425 | } |
@@ -467,9 +467,9 @@ discard block |
||
467 | 467 | private function getFooterData($columnSpec) |
468 | 468 | { |
469 | 469 | if ($this->isFunctionSpecified($columnSpec)) { |
470 | - return call_user_func($columnSpec['function']); |
|
470 | + return call_user_func($columnSpec[ 'function' ]); |
|
471 | 471 | } else { |
472 | - return isset($columnSpec['value']) ? $columnSpec['value'] : ""; |
|
472 | + return isset($columnSpec[ 'value' ]) ? $columnSpec[ 'value' ] : ""; |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
@@ -482,9 +482,9 @@ discard block |
||
482 | 482 | */ |
483 | 483 | public function getHTMLTable() |
484 | 484 | { |
485 | - $id = isset($this->tableSpec['id']) ? " id='{$this->tableSpec['id']}'" : null; |
|
486 | - $class = isset($this->tableSpec['class']) ? " class='{$this->tableSpec['class']}'" : null; |
|
487 | - $caption = isset($this->tableSpec['caption']) ? "<caption>{$this->tableSpec['caption']}</caption>" : null; |
|
485 | + $id = isset($this->tableSpec[ 'id' ]) ? " id='{$this->tableSpec[ 'id' ]}'" : null; |
|
486 | + $class = isset($this->tableSpec[ 'class' ]) ? " class='{$this->tableSpec[ 'class' ]}'" : null; |
|
487 | + $caption = isset($this->tableSpec[ 'caption' ]) ? "<caption>{$this->tableSpec[ 'caption' ]}</caption>" : null; |
|
488 | 488 | |
489 | 489 | $htmlTable = "<table{$id}{$class}>"; |
490 | 490 | $htmlTable .= $caption; |