@@ -30,17 +30,16 @@ public function buildInputArgs(): void
30
30
{
31
31
$ definition = new InputDefinition ();
32
32
33
- $ argument = new InputArgument ('cobertura-file ' , InputArgument::OPTIONAL );
34
- $ definition ->addArgument ($ argument );
33
+ $ definition ->addArguments ([
34
+ new InputArgument ('cobertura-file ' , InputArgument::OPTIONAL )
35
+ ]);
35
36
36
- $ option = new InputOption ('init ' , null , InputOption::VALUE_NONE );
37
- $ definition ->addOption ($ option );
38
-
39
- $ option = new InputOption ('no-color ' , null , InputOption::VALUE_NONE );
40
- $ definition ->addOption ($ option );
41
-
42
- $ option = new InputOption ('filter-class-name ' , null , InputOption::VALUE_REQUIRED );
43
- $ definition ->addOption ($ option );
37
+ $ definition ->addOptions ([
38
+ new InputOption ('init ' , null , InputOption::VALUE_NONE ),
39
+ new InputOption ('no-color ' , null , InputOption::VALUE_NONE ),
40
+ new InputOption ('filter-class-name ' , null , InputOption::VALUE_REQUIRED ),
41
+ new InputOption ('config-file ' , null , InputOption::VALUE_REQUIRED ),
42
+ ]);
44
43
45
44
$ this ->input = new ArgvInput (null , $ definition );
46
45
}
@@ -50,7 +49,7 @@ public function coberturaFile(): string
50
49
$ coberturaFile = (string ) $ this ->input ->getArgument ('cobertura-file ' );
51
50
52
51
if ('' === $ coberturaFile ) {
53
- throw new RuntimeException ('Missing required argument \' path to cobertura XML file \' . ' );
52
+ throw new RuntimeException ('Missing required argument: path to cobertura XML file. ' );
54
53
}
55
54
56
55
return $ coberturaFile ;
@@ -81,4 +80,20 @@ public function optionFilterClassName(): ?string
81
80
82
81
return $ filterClassName ;
83
82
}
83
+
84
+ public function optionConfigFile (): ?string
85
+ {
86
+ /** @var string|null $configFile */
87
+ $ configFile = $ this ->input ->getOption ('config-file ' );
88
+
89
+ if (null === $ configFile ) {
90
+ return null ;
91
+ }
92
+
93
+ if ('' === $ configFile ) {
94
+ throw new RuntimeException ('The "--config-file" option requires a value. ' );
95
+ }
96
+
97
+ return $ configFile ;
98
+ }
84
99
}
0 commit comments