From 4a8d1907d5fc5c054a24130cece8fe738ba46167 Mon Sep 17 00:00:00 2001 From: Darren Benney Date: Sat, 30 Mar 2013 20:07:49 +0000 Subject: Made set_error() method DRY. --- system/libraries/Upload.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'system/libraries/Upload.php') diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 1c14f99ed..4751a850f 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -1076,21 +1076,17 @@ class CI_Upload { $CI =& get_instance(); $CI->lang->load('upload'); - if (is_array($msg)) + if ( ! is_array($msg)) { - foreach ($msg as $val) - { - $msg = ($CI->lang->line($val) === FALSE) ? $val : $CI->lang->line($val); - $this->error_msg[] = $msg; - log_message('error', $msg); - } - } - else - { - $msg = ($CI->lang->line($msg) === FALSE) ? $msg : $CI->lang->line($msg); - $this->error_msg[] = $msg; - log_message('error', $msg); - } + $msg = array($msg); + } + + foreach ($msg as $val) + { + $msg = ($CI->lang->line($val) === FALSE) ? $val : $CI->lang->line($val); + $this->error_msg[] = $msg; + log_message('error', $msg); + } } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b