From 79e3367f679b70cc19af39f2513ae9e891f6f6aa Mon Sep 17 00:00:00 2001 From: recursive_tree Date: Mon, 14 Nov 2022 20:16:13 +0100 Subject: [PATCH] styleci+comments --- src/Http/Validation/Custom/ArtisanCommand.php | 14 ++++++++------ src/Http/Validation/NewSchedule.php | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Http/Validation/Custom/ArtisanCommand.php b/src/Http/Validation/Custom/ArtisanCommand.php index 052a40294..19b4dde5d 100644 --- a/src/Http/Validation/Custom/ArtisanCommand.php +++ b/src/Http/Validation/Custom/ArtisanCommand.php @@ -21,9 +21,8 @@ */ namespace Seat\Web\Http\Validation\Custom; -use Symfony\Component\Console\Input\ArgvInput; + use Artisan; -use Symfony\Component\Console\Exception\RuntimeException; /** * Class ArtisanCommand. @@ -43,17 +42,20 @@ class ArtisanCommand */ public static function validate($attribute, $value, $parameters, $validator) { + //get all commands $allCommands = Artisan::all(); - $argv = explode(" ",$value); + //split arguments + $argv = explode(' ', $value); + //get command name and check if it exists $commandName = $argv[0] ?? null; - if($commandName===null) return false; - if(!array_key_exists($commandName,$allCommands)) return false; + if($commandName === null) return false; + if(! array_key_exists($commandName, $allCommands)) return false; //I haven't found a way to validate the arguments, so we assume they are alright - + //all checks have passed, we can allow it return true; } } diff --git a/src/Http/Validation/NewSchedule.php b/src/Http/Validation/NewSchedule.php index c678bff03..bfeecfd15 100644 --- a/src/Http/Validation/NewSchedule.php +++ b/src/Http/Validation/NewSchedule.php @@ -22,7 +22,6 @@ namespace Seat\Web\Http\Validation; -use Artisan; use Illuminate\Foundation\Http\FormRequest; /**