Use splat operator instead of call_user_func_array
This commit is contained in:
parent
cae5c6e5cf
commit
5c55e45c3c
@ -37,7 +37,7 @@ class GenericTable extends PageIndex
|
|||||||
$this->tableIsSortable = !empty($options['base_url']);
|
$this->tableIsSortable = !empty($options['base_url']);
|
||||||
|
|
||||||
// How much stuff do we have?
|
// How much stuff do we have?
|
||||||
$this->recordCount = call_user_func_array($options['get_count'], !empty($options['get_count_params']) ? $options['get_count_params'] : []);
|
$this->recordCount = $options['get_count'](...(!empty($options['get_count_params']) ? $options['get_count_params'] : []));
|
||||||
|
|
||||||
// Should we create a page index?
|
// Should we create a page index?
|
||||||
$this->items_per_page = !empty($options['items_per_page']) ? $options['items_per_page'] : 30;
|
$this->items_per_page = !empty($options['items_per_page']) ? $options['items_per_page'] : 30;
|
||||||
@ -60,7 +60,7 @@ class GenericTable extends PageIndex
|
|||||||
$parameters = array_merge($parameters, $options['get_data_params']);
|
$parameters = array_merge($parameters, $options['get_data_params']);
|
||||||
|
|
||||||
// Okay, let's fetch the data!
|
// Okay, let's fetch the data!
|
||||||
$data = call_user_func_array($options['get_data'], $parameters);
|
$data = $options['get_data'](...$parameters);
|
||||||
|
|
||||||
// Clean up a bit.
|
// Clean up a bit.
|
||||||
$rows = $data['rows'];
|
$rows = $data['rows'];
|
||||||
@ -150,7 +150,7 @@ class GenericTable extends PageIndex
|
|||||||
$parameters = [$column['parse']['data']['pattern']];
|
$parameters = [$column['parse']['data']['pattern']];
|
||||||
foreach ($column['parse']['data']['arguments'] as $identifier)
|
foreach ($column['parse']['data']['arguments'] as $identifier)
|
||||||
$parameters[] = $row[$identifier];
|
$parameters[] = $row[$identifier];
|
||||||
$value = call_user_func_array('sprintf', $parameters);
|
$value = sprintf(...$parameters);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// timestamps: let's make them readable!
|
// timestamps: let's make them readable!
|
||||||
|
Loading…
Reference in New Issue
Block a user