summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-11 16:56:44 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-11 16:56:44 +0100
commitf0b69a85e306266bcaa7d6b7f363cc9d64b7b8f7 (patch)
treeff88ed06cb1ec34736d4487a557e51fe217324a6 /system
parent3fcc3f6160ca7cd6fd30b3deb6f58d6a95c9c5e2 (diff)
More code reduced from CI_Table
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Table.php22
1 files changed, 5 insertions, 17 deletions
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;