From eb3ddf2bf7d1b44aa433aad96b5c63fd3a79ae4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Sat, 16 Apr 2016 21:34:22 +0200 Subject: [PATCH] [OPTIMISATION] Optimized get method in Input class to trim value and return default value if empty. --- src/Pecee/Http/Input/Input.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pecee/Http/Input/Input.php b/src/Pecee/Http/Input/Input.php index 475b19c..db45b00 100644 --- a/src/Pecee/Http/Input/Input.php +++ b/src/Pecee/Http/Input/Input.php @@ -89,7 +89,7 @@ class Input { return ($key !== null && isset($item->getValue()[$key])) ? $item->getValue()[$key] : $item->getValue(); } - return ($item->getValue() === null) ? $default : $item->getValue(); + return (trim($item->getValue()) === '') ? $default : $item->getValue(); } return $default;