From 91a6cb882e2500556c0a69a0991741f239f69b2c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 21 Mar 2012 12:06:31 -0500 Subject: [PATCH] Added wrap_value function to grammar. --- laravel/database/grammar.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/laravel/database/grammar.php b/laravel/database/grammar.php index 9dcb34ee..055b97a9 100644 --- a/laravel/database/grammar.php +++ b/laravel/database/grammar.php @@ -91,19 +91,23 @@ public function wrap($value) // the table and the column in keyword identifiers. foreach (explode('.', $value) as $segment) { - if ($segment == '*') - { - $wrapped[] = $segment; - } - else - { - $wrapped[] = sprintf($this->wrapper, $segment); - } + $wrapped[] = $this->wrap_value($segment); } return implode('.', $wrapped); } + /** + * Wrap a single string value in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrap_value($value) + { + return ($value !== '*') ? sprintf($this->wrapper, $value) : $value; + } + /** * Create query parameters from an array of values. *