@@ -44,35 +44,35 @@ |
||
| 44 | 44 | |
| 45 | 45 | private function _registerDataTable(): void |
| 46 | 46 | { |
| 47 | - $this->app->bind('datatable', function () { |
|
| 47 | + $this->app->bind('datatable', function() { |
|
| 48 | 48 | return new DataTable(); |
| 49 | 49 | }); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | private function _registerSessionHelper(): void |
| 53 | 53 | { |
| 54 | - $this->app->singleton('session_helper', function () { |
|
| 54 | + $this->app->singleton('session_helper', function() { |
|
| 55 | 55 | return new SessionHelper(); |
| 56 | 56 | }); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | private function _registerUrlHelper(): void |
| 60 | 60 | { |
| 61 | - $this->app->singleton('url_helper', function () { |
|
| 61 | + $this->app->singleton('url_helper', function() { |
|
| 62 | 62 | return new UrlHelper(); |
| 63 | 63 | }); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | private function _registerTableRenderer(): void |
| 67 | 67 | { |
| 68 | - $this->app->singleton('table_renderer', function () { |
|
| 68 | + $this->app->singleton('table_renderer', function() { |
|
| 69 | 69 | return new TableRenderer(); |
| 70 | 70 | }); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | private function _setDataTableAlias(): void |
| 74 | 74 | { |
| 75 | - $this->app->booting(function () { |
|
| 75 | + $this->app->booting(function() { |
|
| 76 | 76 | AliasLoader::getInstance()->alias('DataTable', DataTableFacade::class); |
| 77 | 77 | }); |
| 78 | 78 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param string|null $name |
| 136 | 136 | * @return $this|DataTable |
| 137 | 137 | */ |
| 138 | - public function addComponent(DataComponent $component, ?string $name = null): DataTable |
|
| 138 | + public function addComponent(DataComponent $component, ? string $name = null) : DataTable |
|
| 139 | 139 | { |
| 140 | 140 | $componentName = \str_replace(' ', '', Str::lower($name ?? \class_basename($component))); |
| 141 | 141 | if ($this->componentExists($componentName)) throw new MultipleComponentAssertionException(); |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | /** @var Column $column */ |
| 180 | 180 | $column = \array_first( |
| 181 | 181 | $this->_columns, |
| 182 | - function ($index, $column) use ($columnName) { |
|
| 182 | + function($index, $column) use ($columnName) { |
|
| 183 | 183 | /** @var Column $column */ |
| 184 | 184 | return $column->getName() === $columnName; |
| 185 | 185 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | if (!empty($columns)) { |
| 333 | 333 | $query->selectRaw( |
| 334 | 334 | \implode(',', |
| 335 | - \array_map(function ($column) { |
|
| 335 | + \array_map(function($column) { |
|
| 336 | 336 | return $column->getIdentifier(); |
| 337 | 337 | }, $columns) |
| 338 | 338 | ) |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | { |
| 350 | 350 | return \array_filter( |
| 351 | 351 | $this->_columns, |
| 352 | - function ($column) { |
|
| 352 | + function($column) { |
|
| 353 | 353 | return !$column->isMutated(); |
| 354 | 354 | } |
| 355 | 355 | ); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | private function _fetchHeaders(): array |
| 369 | 369 | { |
| 370 | 370 | return \array_map( |
| 371 | - function ($column) { |
|
| 371 | + function($column) { |
|
| 372 | 372 | /** @var Column $column */ |
| 373 | 373 | return new Header($column->getKey()); |
| 374 | 374 | }, |
@@ -138,7 +138,9 @@ discard block |
||
| 138 | 138 | public function addComponent(DataComponent $component, ?string $name = null): DataTable |
| 139 | 139 | { |
| 140 | 140 | $componentName = \str_replace(' ', '', Str::lower($name ?? \class_basename($component))); |
| 141 | - if ($this->componentExists($componentName)) throw new MultipleComponentAssertionException(); |
|
| 141 | + if ($this->componentExists($componentName)) { |
|
| 142 | + throw new MultipleComponentAssertionException(); |
|
| 143 | + } |
|
| 142 | 144 | $this->_components[$componentName] = $component->init($this); |
| 143 | 145 | |
| 144 | 146 | return $this; |
@@ -378,7 +380,9 @@ discard block |
||
| 378 | 380 | |
| 379 | 381 | public function __get($name) |
| 380 | 382 | { |
| 381 | - if (\array_key_exists($name, $this->_components)) return $this->_components[$name]; |
|
| 383 | + if (\array_key_exists($name, $this->_components)) { |
|
| 384 | + return $this->_components[$name]; |
|
| 385 | + } |
|
| 382 | 386 | |
| 383 | 387 | return $this->$name; |
| 384 | 388 | } |