diff --git a/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php b/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php index b82bdbfa8127..80be7a476e90 100644 --- a/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php +++ b/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php @@ -62,13 +62,25 @@ protected function transform($key, $value) { $except = array_merge($this->except, static::$neverTrim); - if (in_array($key, $except, true) || ! is_string($value)) { + if ($this->shouldSkip($key, $except) || ! is_string($value)) { return $value; } return Str::trim($value); } + /** + * Determine if the given key should be skipped. + * + * @param string $key + * @param array $except + * @return bool + */ + protected function shouldSkip($key, $except) + { + return in_array($key, $except, true); + } + /** * Indicate that the given attributes should never be trimmed. *