Refactor leftover old-style arrays into new-style arrays.
This commit is contained in:
@@ -30,14 +30,14 @@ class GenericTable extends PageIndex
|
||||
$options['sort_order'] = '';
|
||||
|
||||
// Order in which direction?
|
||||
if (!empty($options['sort_direction']) && !in_array($options['sort_direction'], array('up', 'down')))
|
||||
if (!empty($options['sort_direction']) && !in_array($options['sort_direction'], ['up', 'down']))
|
||||
$options['sort_direction'] = 'up';
|
||||
|
||||
// Make sure we know whether we can actually sort on something.
|
||||
$this->tableIsSortable = !empty($options['base_url']);
|
||||
|
||||
// How much stuff do we have?
|
||||
$this->recordCount = call_user_func_array($options['get_count'], !empty($options['get_count_params']) ? $options['get_count_params'] : array());
|
||||
$this->recordCount = call_user_func_array($options['get_count'], !empty($options['get_count_params']) ? $options['get_count_params'] : []);
|
||||
|
||||
// Should we create a page index?
|
||||
$this->items_per_page = !empty($options['items_per_page']) ? $options['items_per_page'] : 30;
|
||||
@@ -55,7 +55,7 @@ class GenericTable extends PageIndex
|
||||
$options['no_items_label'] = '';
|
||||
|
||||
// Gather parameters for the data gather function first.
|
||||
$parameters = array($this->start, $this->items_per_page, $options['sort_order'], $options['sort_direction']);
|
||||
$parameters = [$this->start, $this->items_per_page, $options['sort_order'], $options['sort_direction']];
|
||||
if (!empty($options['get_data_params']) && is_array($options['get_data_params']))
|
||||
$parameters = array_merge($parameters, $options['get_data_params']);
|
||||
|
||||
@@ -98,7 +98,7 @@ class GenericTable extends PageIndex
|
||||
if (empty($column['header']))
|
||||
continue;
|
||||
|
||||
$header = array(
|
||||
$header = [
|
||||
'class' => isset($column['class']) ? $column['class'] : '',
|
||||
'colspan' => !empty($column['header_colspan']) ? $column['header_colspan'] : 1,
|
||||
'href' => !$this->tableIsSortable || empty($column['is_sortable']) ? '' : $this->getLink($this->start, $key, $key == $this->sort_order && $this->sort_direction == 'up' ? 'down' : 'up'),
|
||||
@@ -106,7 +106,7 @@ class GenericTable extends PageIndex
|
||||
'scope' => 'col',
|
||||
'sort_mode' => $key == $this->sort_order ? $this->sort_direction : null,
|
||||
'width' => !empty($column['header_width']) && is_int($column['header_width']) ? $column['header_width'] : null,
|
||||
);
|
||||
];
|
||||
|
||||
$this->header[] = $header;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ class GenericTable extends PageIndex
|
||||
|
||||
// sprintf: filling the gaps!
|
||||
case 'sprintf':
|
||||
$parameters = array($column['parse']['data']['pattern']);
|
||||
$parameters = [$column['parse']['data']['pattern']];
|
||||
foreach ($column['parse']['data']['arguments'] as $identifier)
|
||||
$parameters[] = $row[$identifier];
|
||||
$value = call_user_func_array('sprintf', $parameters);
|
||||
@@ -196,10 +196,10 @@ class GenericTable extends PageIndex
|
||||
$value = $row[$column['value']];
|
||||
|
||||
// Append the cell to the row.
|
||||
$newRow['cells'][] = array(
|
||||
$newRow['cells'][] = [
|
||||
'width' => !empty($column['cell_width']) && is_int($column['cell_width']) ? $column['cell_width'] : null,
|
||||
'value' => $value,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
// Append the new row in the body.
|
||||
|
||||
Reference in New Issue
Block a user