From f0b69a85e306266bcaa7d6b7f363cc9d64b7b8f7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 11 Feb 2014 17:56:44 +0200 Subject: More code reduced from CI_Table --- system/libraries/Table.php | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 79632b3da..179eb8de7 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -242,26 +242,14 @@ class CI_Table { // If there is no $args[0], skip this and treat as an associative array // This can happen if there is only a single key, for example this is passed to table->generate // array(array('foo'=>'bar')) - if (isset($args[0]) && count($args) === 1 && is_array($args[0])) + if (isset($args[0]) && count($args) === 1 && is_array($args[0]) && ! isset($args[0]['data'])) { - // args sent as indexed array - if ( ! isset($args[0]['data'])) - { - foreach ($args[0] as $key => $val) - { - $args[$key] = (is_array($val) && isset($val['data'])) ? $val : array('data' => $val); - } - } + $args = $args[0]; } - else + + foreach ($args as $key => $val) { - foreach ($args as $key => $val) - { - if ( ! is_array($val)) - { - $args[$key] = array('data' => $val); - } - } + is_array($val) OR $args[$key] = array('data' => $val); } return $args; -- cgit v1.2.3-24-g4f1b