File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 44
55namespace PhpSchool \PhpWorkshop \Command ;
66
7+ use PhpSchool \PhpWorkshop \Check \FileExistsCheck ;
78use PhpSchool \PhpWorkshop \ExerciseDispatcher ;
89use PhpSchool \PhpWorkshop \ExerciseRepository ;
910use PhpSchool \PhpWorkshop \Input \Input ;
1011use PhpSchool \PhpWorkshop \Output \OutputInterface ;
12+ use PhpSchool \PhpWorkshop \Result \Success ;
1113use PhpSchool \PhpWorkshop \UserState ;
1214
1315/**
@@ -60,6 +62,11 @@ public function __construct(
6062 */
6163 public function __invoke (Input $ input ): void
6264 {
65+ if (!file_exists ($ input ->getRequiredArgument ('program ' ))) {
66+ $ this ->output ->printError (sprintf ('File: "%s" does not exist ' , $ input ->getRequiredArgument ('program ' )));
67+ return ;
68+ }
69+
6370 $ exercise = $ this ->exerciseRepository ->findByName ($ this ->userState ->getCurrentExercise ());
6471 $ this ->exerciseDispatcher ->run ($ exercise , $ input , $ this ->output );
6572 }
You can’t perform that action at this time.
0 commit comments