@@ -41,7 +41,7 @@ |
||
41 | 41 | ], |
42 | 42 | ]; |
43 | 43 | |
44 | -$table = $table->create([], $data, []); |
|
44 | +$table = $table->create([ ], $data, [ ]); |
|
45 | 45 | |
46 | 46 | ?> |
47 | 47 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | // Get environment & autoloader. |
21 | - require __DIR__.'/config.php'; |
|
21 | + require __DIR__ . '/config.php'; |
|
22 | 22 | |
23 | 23 | // Create services and inject into the app. |
24 | 24 | $di = new \Anax\DI\CDIFactoryDefault(); |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | 'column4' => [ |
75 | 75 | 'title' => 'Table Header 4', |
76 | 76 | 'function' => function($link) { |
77 | - return '<a href="'. $link . '">' . "Google" . '</a>'; |
|
77 | + return '<a href="' . $link . '">' . "Google" . '</a>'; |
|
78 | 78 | } |
79 | 79 | ], |
80 | 80 | 'column6' => [ |
81 | 81 | 'title' => 'Table Header 6', |
82 | 82 | 'function' => function($isPresent) { |
83 | - return empty($isPresent) ? 'Not present' : 'Present'; |
|
83 | + return empty($isPresent) ? 'Not present' : 'Present'; |
|
84 | 84 | } |
85 | 85 | ], |
86 | 86 | 'tablefoot1' => [ |
@@ -62,13 +62,13 @@ |
||
62 | 62 | 'column4' => [ |
63 | 63 | 'title' => 'Table Header 4', |
64 | 64 | 'function' => function($link) { |
65 | - return '<a href="'. $link . '">' . "Google" . '</a>'; |
|
65 | + return '<a href="' . $link . '">' . "Google" . '</a>'; |
|
66 | 66 | } |
67 | 67 | ], |
68 | 68 | 'column6' => [ |
69 | 69 | 'title' => 'Table Header 6', |
70 | 70 | 'function' => function($tableCell6) { |
71 | - return empty($tableCell6) ? 'Not present' : 'Present'; |
|
71 | + return empty($tableCell6) ? 'Not present' : 'Present'; |
|
72 | 72 | } |
73 | 73 | ], |
74 | 74 | 'tablefoot1' => [ |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * @return void |
13 | 13 | */ |
14 | 14 | spl_autoload_register( |
15 | - function ($class) { |
|
15 | + function($class) { |
|
16 | 16 | |
17 | 17 | // project-specific namespace prefix |
18 | 18 | //$prefix = 'Foo\\Bar\\'; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param [] $data table cell data. |
36 | 36 | * @param [] $columnSpecs table columns cell settings. |
37 | 37 | */ |
38 | - public function __construct($tableSpecs = [], $data = [], $columnSpecs = []) |
|
38 | + public function __construct($tableSpecs = [ ], $data = [ ], $columnSpecs = [ ]) |
|
39 | 39 | { |
40 | 40 | $this->create($tableSpecs, $data, $columnSpecs); |
41 | 41 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return object the html table object. |
55 | 55 | */ |
56 | - public function create($tableSpecs = [], $data = [], $columnSpecs = []) |
|
56 | + public function create($tableSpecs = [ ], $data = [ ], $columnSpecs = [ ]) |
|
57 | 57 | { |
58 | 58 | $this->resetTableTags(); |
59 | 59 | $this->setTableSpecifications($tableSpecs); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function isClassPresent($tableSpec) |
117 | 117 | { |
118 | - return isset($tableSpec['class']) ? true : false; |
|
118 | + return isset($tableSpec[ 'class' ]) ? true : false; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return [] the table specification without the CSS id tag. |
129 | 129 | */ |
130 | 130 | private function removeId($tableSpec) { |
131 | - $tableSpec['id'] = null; |
|
131 | + $tableSpec[ 'id' ] = null; |
|
132 | 132 | |
133 | 133 | return $tableSpec; |
134 | 134 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | private function setColumnTitlesFromData($data) |
176 | 176 | { |
177 | - $firstRow = isset($data[0]) ? $data[0] : []; |
|
177 | + $firstRow = isset($data[ 0 ]) ? $data[ 0 ] : [ ]; |
|
178 | 178 | foreach ($firstRow as $key => $value) { |
179 | 179 | $this->tableHead .= "\n<th>"; |
180 | 180 | $this->tableHead .= $key; |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | private function isTableFooter($columnSpec) |
217 | 217 | { |
218 | 218 | $isFooter = false; |
219 | - if (isset($columnSpec['type'])) { |
|
220 | - if (strcmp($columnSpec['type'], self::FOOTER) === 0) { |
|
219 | + if (isset($columnSpec[ 'type' ])) { |
|
220 | + if (strcmp($columnSpec[ 'type' ], self::FOOTER) === 0) { |
|
221 | 221 | $isFooter = true; |
222 | 222 | } |
223 | 223 | } |
@@ -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 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | private function getColspan($columnSpec) |
342 | 342 | { |
343 | - return isset($columnSpec['colspan']) ? " colspan='{$columnSpec['colspan']}'" : null; |
|
343 | + return isset($columnSpec[ 'colspan' ]) ? " colspan='{$columnSpec[ 'colspan' ]}'" : null; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | private function getValue($row, $key, $columnSpec) |
359 | 359 | { |
360 | 360 | if ($this->isFunctionSpecified($columnSpec)) { |
361 | - $dataValue = isset($row[$key]) ? $row[$key] : ""; |
|
361 | + $dataValue = isset($row[ $key ]) ? $row[ $key ] : ""; |
|
362 | 362 | return $this->getValueThroughFunction($columnSpec, $dataValue); |
363 | 363 | } else { |
364 | - return isset($row[$key]) ? $row[$key] : ""; |
|
364 | + return isset($row[ $key ]) ? $row[ $key ] : ""; |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | */ |
378 | 378 | private function isFunctionSpecified($columnSpec) |
379 | 379 | { |
380 | - return isset($columnSpec['function']) ? true : false; |
|
380 | + return isset($columnSpec[ 'function' ]) ? true : false; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | */ |
395 | 395 | private function getValueThroughFunction($columnSpec, $dataValue) |
396 | 396 | { |
397 | - if (!empty($columnSpec['function'])) { |
|
398 | - return call_user_func($columnSpec['function'], $dataValue); |
|
397 | + if (!empty($columnSpec[ 'function' ])) { |
|
398 | + return call_user_func($columnSpec[ 'function' ], $dataValue); |
|
399 | 399 | } else { |
400 | 400 | return $dataValue; |
401 | 401 | } |
@@ -451,9 +451,9 @@ discard block |
||
451 | 451 | private function getFooterData($columnSpec) |
452 | 452 | { |
453 | 453 | if ($this->isFunctionSpecified($columnSpec)) { |
454 | - return call_user_func($columnSpec['function']); |
|
454 | + return call_user_func($columnSpec[ 'function' ]); |
|
455 | 455 | } else { |
456 | - return isset($columnSpec['value']) ? $columnSpec['value'] : ""; |
|
456 | + return isset($columnSpec[ 'value' ]) ? $columnSpec[ 'value' ] : ""; |
|
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
@@ -466,9 +466,9 @@ discard block |
||
466 | 466 | */ |
467 | 467 | public function getHTMLTable() |
468 | 468 | { |
469 | - $id = isset($this->tableSpec['id']) ? " id='{$this->tableSpec['id']}'" : null; |
|
470 | - $class = isset($this->tableSpec['class']) ? " class='{$this->tableSpec['class']}'" : null; |
|
471 | - $caption = isset($this->tableSpec['caption']) ? "<caption>{$this->tableSpec['caption']}</caption>" : null; |
|
469 | + $id = isset($this->tableSpec[ 'id' ]) ? " id='{$this->tableSpec[ 'id' ]}'" : null; |
|
470 | + $class = isset($this->tableSpec[ 'class' ]) ? " class='{$this->tableSpec[ 'class' ]}'" : null; |
|
471 | + $caption = isset($this->tableSpec[ 'caption' ]) ? "<caption>{$this->tableSpec[ 'caption' ]}</caption>" : null; |
|
472 | 472 | |
473 | 473 | $htmlTable = "<table{$id}{$class}>"; |
474 | 474 | $htmlTable .= $caption; |