File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace PhpSchool \PhpWorkshop \Command ;
6
6
7
+ use PhpSchool \PhpWorkshop \Check \FileExistsCheck ;
7
8
use PhpSchool \PhpWorkshop \ExerciseDispatcher ;
8
9
use PhpSchool \PhpWorkshop \ExerciseRepository ;
9
10
use PhpSchool \PhpWorkshop \Input \Input ;
10
11
use PhpSchool \PhpWorkshop \Output \OutputInterface ;
12
+ use PhpSchool \PhpWorkshop \Result \Success ;
11
13
use PhpSchool \PhpWorkshop \UserState ;
12
14
13
15
/**
@@ -60,6 +62,11 @@ public function __construct(
60
62
*/
61
63
public function __invoke (Input $ input ): void
62
64
{
65
+ if (!file_exists ($ input ->getRequiredArgument ('program ' ))) {
66
+ $ this ->output ->printError (sprintf ('File: "%s" does not exist ' , $ input ->getRequiredArgument ('program ' )));
67
+ return ;
68
+ }
69
+
63
70
$ exercise = $ this ->exerciseRepository ->findByName ($ this ->userState ->getCurrentExercise ());
64
71
$ this ->exerciseDispatcher ->run ($ exercise , $ input , $ this ->output );
65
72
}
You can’t perform that action at this time.
0 commit comments