Skip to content

Commit f0b69a8

Browse files
committed
More code reduced from CI_Table
1 parent 3fcc3f6 commit f0b69a8

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

system/libraries/Table.php

+5-17
Original file line numberDiff line numberDiff line change
@@ -242,26 +242,14 @@ protected function _prep_args($args)
242242
// If there is no $args[0], skip this and treat as an associative array
243243
// This can happen if there is only a single key, for example this is passed to table->generate
244244
// array(array('foo'=>'bar'))
245-
if (isset($args[0]) && count($args) === 1 && is_array($args[0]))
245+
if (isset($args[0]) && count($args) === 1 && is_array($args[0]) && ! isset($args[0]['data']))
246246
{
247-
// args sent as indexed array
248-
if ( ! isset($args[0]['data']))
249-
{
250-
foreach ($args[0] as $key => $val)
251-
{
252-
$args[$key] = (is_array($val) && isset($val['data'])) ? $val : array('data' => $val);
253-
}
254-
}
247+
$args = $args[0];
255248
}
256-
else
249+
250+
foreach ($args as $key => $val)
257251
{
258-
foreach ($args as $key => $val)
259-
{
260-
if ( ! is_array($val))
261-
{
262-
$args[$key] = array('data' => $val);
263-
}
264-
}
252+
is_array($val) OR $args[$key] = array('data' => $val);
265253
}
266254

267255
return $args;

0 commit comments

Comments
 (0)