@@ -30,17 +30,16 @@ public function buildInputArgs(): void
3030 {
3131 $ definition = new InputDefinition ();
3232
33- $ argument = new InputArgument ('cobertura-file ' , InputArgument::OPTIONAL );
34- $ definition ->addArgument ($ argument );
33+ $ definition ->addArguments ([
34+ new InputArgument ('cobertura-file ' , InputArgument::OPTIONAL )
35+ ]);
3536
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+ ]);
4443
4544 $ this ->input = new ArgvInput (null , $ definition );
4645 }
@@ -50,7 +49,7 @@ public function coberturaFile(): string
5049 $ coberturaFile = (string ) $ this ->input ->getArgument ('cobertura-file ' );
5150
5251 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. ' );
5453 }
5554
5655 return $ coberturaFile ;
@@ -81,4 +80,20 @@ public function optionFilterClassName(): ?string
8180
8281 return $ filterClassName ;
8382 }
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+ }
8499}
0 commit comments