Skip to content

Commit

Permalink
styleci+comments
Browse files Browse the repository at this point in the history
  • Loading branch information
recursivetree committed Nov 14, 2022
1 parent 005ebb7 commit 79e3367
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/Http/Validation/Custom/ArtisanCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}
}
1 change: 0 additions & 1 deletion src/Http/Validation/NewSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

namespace Seat\Web\Http\Validation;

use Artisan;
use Illuminate\Foundation\Http\FormRequest;

/**
Expand Down

0 comments on commit 79e3367

Please sign in to comment.