@@ -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 | |
@@ -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\\'; |
@@ -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; |
@@ -84,13 +84,13 @@ |
||
| 84 | 84 | 'column4' => [ |
| 85 | 85 | 'title' => 'Table Header 4', |
| 86 | 86 | 'function' => function($link) { |
| 87 | - return '<a href="'. htmlentities($link, null, 'UTF-8') . '">' . "Google" . '</a>'; |
|
| 87 | + return '<a href="' . htmlentities($link, null, 'UTF-8') . '">' . "Google" . '</a>'; |
|
| 88 | 88 | } |
| 89 | 89 | ], |
| 90 | 90 | 'column6' => [ |
| 91 | 91 | 'title' => 'Table Header 6', |
| 92 | 92 | 'function' => function($tableCell6) { |
| 93 | - return empty($tableCell6) ? 'Not present' : 'Present'; |
|
| 93 | + return empty($tableCell6) ? 'Not present' : 'Present'; |
|
| 94 | 94 | } |
| 95 | 95 | ], |
| 96 | 96 | 'tablefoot1' => [ |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | 32 | // Get environment & autoloader. |
| 33 | - require __DIR__.'/config.php'; |
|
| 33 | + require __DIR__ . '/config.php'; |
|
| 34 | 34 | |
| 35 | 35 | // Create services and inject into the app. |
| 36 | 36 | $di = new \Anax\DI\CDIFactoryDefault(); |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | 'column4' => [ |
| 99 | 99 | 'title' => 'Table Header 4', |
| 100 | 100 | 'function' => function($link) { |
| 101 | - return '<a href="'. htmlentities($link, null, 'UTF-8') . '">' . "Google" . '</a>'; |
|
| 101 | + return '<a href="' . htmlentities($link, null, 'UTF-8') . '">' . "Google" . '</a>'; |
|
| 102 | 102 | } |
| 103 | 103 | ], |
| 104 | 104 | 'column6' => [ |
| 105 | 105 | 'title' => 'Table Header 6', |
| 106 | 106 | 'function' => function($isPresent) { |
| 107 | - return empty($isPresent) ? 'Not present' : 'Present'; |
|
| 107 | + return empty($isPresent) ? 'Not present' : 'Present'; |
|
| 108 | 108 | } |
| 109 | 109 | ], |
| 110 | 110 | 'tablefoot1' => [ |