44
55namespace PhpSchool \PhpWorkshop ;
66
7+ use DI \Container ;
78use DI \ContainerBuilder ;
89use PhpSchool \PhpWorkshop \Check \CheckRepository ;
910use PhpSchool \PhpWorkshop \Exception \InvalidArgumentException ;
1011use PhpSchool \PhpWorkshop \Exception \MissingArgumentException ;
11- use PhpSchool \PhpWorkshop \Exercise \ExerciseInterface ;
1212use PhpSchool \PhpWorkshop \Factory \ResultRendererFactory ;
1313use PhpSchool \PhpWorkshop \Output \OutputInterface ;
14+ use RuntimeException ;
15+
16+ use function class_exists ;
17+ use function is_file ;
18+ use function sprintf ;
1419
1520/**
1621 * This is the main application class, this takes care of bootstrapping, routing and
@@ -46,7 +51,7 @@ final class Application
4651 /**
4752 * @var string|null
4853 */
49- private $ logo = null ;
54+ private $ logo ;
5055
5156 /**
5257 * @var string
@@ -72,8 +77,8 @@ final class Application
7277 */
7378 public function __construct (string $ workshopTitle , string $ diConfigFile )
7479 {
75- if (!\ is_file ($ diConfigFile )) {
76- throw new InvalidArgumentException (\ sprintf ('File "%s" was expected to exist. ' , $ diConfigFile ));
80+ if (!is_file ($ diConfigFile )) {
81+ throw new InvalidArgumentException (sprintf ('File "%s" was expected to exist. ' , $ diConfigFile ));
7782 }
7883
7984 $ this ->workshopTitle = $ workshopTitle ;
@@ -108,12 +113,12 @@ public function addExercise(string $exercise): void
108113 */
109114 public function addResult (string $ resultClass , string $ resultRendererClass ): void
110115 {
111- if (!\ class_exists ($ resultClass )) {
112- throw new InvalidArgumentException (\ sprintf ('Class "%s" does not exist ' , $ resultClass ));
116+ if (!class_exists ($ resultClass )) {
117+ throw new InvalidArgumentException (sprintf ('Class "%s" does not exist ' , $ resultClass ));
113118 }
114119
115- if (!\ class_exists ($ resultRendererClass )) {
116- throw new InvalidArgumentException (\ sprintf ('Class "%s" does not exist ' , $ resultRendererClass ));
120+ if (!class_exists ($ resultRendererClass )) {
121+ throw new InvalidArgumentException (sprintf ('Class "%s" does not exist ' , $ resultRendererClass ));
117122 }
118123
119124 $ this ->results [] = [
@@ -167,7 +172,7 @@ public function run(): int
167172
168173 foreach ($ this ->exercises as $ exercise ) {
169174 if (false === $ container ->has ($ exercise )) {
170- throw new \ RuntimeException (
175+ throw new RuntimeException (
171176 sprintf ('No DI config found for exercise: "%s". Register a factory. ' , $ exercise )
172177 );
173178 }
@@ -176,7 +181,7 @@ public function run(): int
176181 $ checkRepository = $ container ->get (CheckRepository::class);
177182 foreach ($ this ->checks as $ check ) {
178183 if (false === $ container ->has ($ check )) {
179- throw new \ RuntimeException (
184+ throw new RuntimeException (
180185 sprintf ('No DI config found for check: "%s". Register a factory. ' , $ check )
181186 );
182187 }
@@ -206,7 +211,7 @@ public function run(): int
206211 )
207212 );
208213 return 1 ;
209- } catch (\ RuntimeException $ e ) {
214+ } catch (RuntimeException $ e ) {
210215 $ container
211216 ->get (OutputInterface::class)
212217 ->printError (
@@ -221,9 +226,9 @@ public function run(): int
221226 }
222227
223228 /**
224- * @return \DI\ Container
229+ * @return Container
225230 */
226- private function getContainer (): \ DI \ Container
231+ private function getContainer (): Container
227232 {
228233 $ containerBuilder = new ContainerBuilder ();
229234 $ containerBuilder ->addDefinitions (
0 commit comments