@@ -17,8 +17,6 @@ class Command extends BaseCommand
1717 const ENV_USER = 'TNT_JOBQUEUE_USER ' ;
1818 const ENV_PASSWORD = 'TNT_JOBQUEUE_PASSWORD ' ;
1919
20- private $ configFactory ;
21-
2220 protected function configure (): void
2321 {
2422 $ this
@@ -30,20 +28,20 @@ protected function configure(): void
3028 ;
3129 }
3230
33- protected function initialize (InputInterface $ input , OutputInterface $ output ): void
31+ protected function createConfigFactory (InputInterface $ input , OutputInterface $ output ): DefaultConfigFactory
3432 {
3533 $ customConfigPath = $ input ->getOption ('config ' );
3634 if (null !== $ customConfigPath && !is_readable ($ customConfigPath )) {
3735 throw new \RuntimeException ("The given configuration file ' $ customConfigPath' does not exist or it's not readable. " );
3836 }
3937
40- $ this -> configFactory = $ customConfigPath ? include $ customConfigPath : new DefaultConfigFactory ();
38+ $ configFactory = $ customConfigPath ? include $ customConfigPath : new DefaultConfigFactory ();
4139
4240 $ uri = sprintf ('tcp://%s:%s ' , $ input ->getOption ('host ' ), $ input ->getOption ('port ' ));
43- $ this -> configFactory ->setConnectionUri ($ uri );
41+ $ configFactory ->setConnectionUri ($ uri );
4442
4543 $ queueName = $ input ->getArgument ('queue ' );
46- $ this -> configFactory ->setQueueName ($ queueName );
44+ $ configFactory ->setQueueName ($ queueName );
4745
4846 $ user = $ input ->getOption ('user ' ) ?: getenv (self ::ENV_USER );
4947 if ($ user ) {
@@ -55,12 +53,9 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
5553 $ password = $ helper ->ask ($ input , $ output , $ question );
5654 }
5755
58- $ this -> configFactory ->setCredentials ($ user , $ password );
56+ $ configFactory ->setCredentials ($ user , $ password );
5957 }
60- }
6158
62- protected function getConfigFactory (): DefaultConfigFactory
63- {
64- return $ this ->configFactory ;
59+ return $ configFactory ;
6560 }
6661}
0 commit comments