From b1cde1fdd77aec1278dd2b4d6ae071e814a58c2a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 8 Dec 2015 13:10:41 +0200 Subject: Type-hint csv_from_result(), xml_from_result() DB utilities Close #4299 --- system/database/DB_utility.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'system/database') diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index b51893e18..fcc56f24e 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -235,13 +235,8 @@ abstract class CI_DB_utility { * @param string $enclosure Enclosure (default: ") * @return string */ - public function csv_from_result($query, $delim = ',', $newline = "\n", $enclosure = '"') + public function csv_from_result(CI_DB_result $query, $delim = ',', $newline = "\n", $enclosure = '"') { - if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) - { - show_error('You must submit a valid result object'); - } - $out = ''; // First generate the headings from the table column names foreach ($query->list_fields() as $name) @@ -274,13 +269,8 @@ abstract class CI_DB_utility { * @param array $params Any preferences * @return string */ - public function xml_from_result($query, $params = array()) + public function xml_from_result(CI_DB_result $query, $params = array()) { - if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) - { - show_error('You must submit a valid result object'); - } - // Set our default values foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) { -- cgit v1.2.3-24-g4f1b