From 007fea95fc027a0bb471d100cd5c17ef94ae7069 Mon Sep 17 00:00:00 2001 From: poppabear8883 Date: Wed, 15 Aug 2018 11:00:03 -0400 Subject: [PATCH] fix: Validates user input has no spaces As of right now I can not see any reason to allow spaces in user input for ANY of the fields (not just those in the `.env`). Closes #13 Ref: Issue #5 --- src/Traits/ConsoleTools.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Traits/ConsoleTools.php b/src/Traits/ConsoleTools.php index 767a531..cce3d64 100644 --- a/src/Traits/ConsoleTools.php +++ b/src/Traits/ConsoleTools.php @@ -75,14 +75,14 @@ protected function question($question, $default = '') do { $answer = $this->io->ask($question, $default); - $valid = ($answer !== ''); + $valid = ($answer !== '' && strpos($answer, ' ') === false); if (!$valid) { - $this->warning('Cannot be empty!'); + $this->warning('Cannot be empty or contain spaces!'); } } while (!$valid); - return $answer; + return trim($answer); } } \ No newline at end of file