diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-01-19 14:13:32 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-01-19 14:13:32 +0100 |
commit | 63a21005ec657aa004b5ffc2b0965c1a201e4637 (patch) | |
tree | 561ea2a2e0b9c547a9f967bb48cf84ffd86f7393 /system/helpers/array_helper.php | |
parent | 4f2933d28370ad965059222553d8ace1dd2fe602 (diff) |
Some more cleaning
Diffstat (limited to 'system/helpers/array_helper.php')
-rw-r--r-- | system/helpers/array_helper.php | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index a454f936d..82f0eb16c 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -9,7 +9,7 @@ * Licensed under the Open Software License version 3.0 * * This source file is subject to the Open Software License (OSL 3.0) that is - * bundled with this package in the files license.txt / license.rst. It is + * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: * http://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to obtain it @@ -53,12 +53,7 @@ if ( ! function_exists('element')) { function element($item, $array, $default = FALSE) { - if ( ! isset($array[$item]) OR $array[$item] == "") - { - return $default; - } - - return $array[$item]; + return ( ! isset($array[$item]) OR $array[$item] == '') ? $default : $array[$item]; } } @@ -75,7 +70,7 @@ if ( ! function_exists('random_element')) { function random_element($array) { - return (is_array($array)) ? $array[array_rand($array)] : $array; + return is_array($array) ? $array[array_rand($array)] : $array; } } @@ -105,7 +100,7 @@ if ( ! function_exists('elements')) foreach ($items as $item) { - $return[$item] = (isset($array[$item])) ? $array[$item] : $default; + $return[$item] = isset($array[$item]) ? $array[$item] : $default; } return $return; |