1 | <?php |
||
23 | abstract class AbstractCommand extends Command |
||
24 | { |
||
25 | protected const CODE_SUCCESS = 0; |
||
26 | protected const CODE_ERROR = 1; |
||
27 | protected const ENV_PROD = 'prod'; |
||
28 | protected const ENV_DEV = 'dev'; |
||
29 | protected const ENV_TEST = 'test'; |
||
30 | protected const OPTION_RUN = 'run'; |
||
31 | protected const LINE_SEPARATOR = '-------------------------------------------------------------'; |
||
32 | protected $environments = []; |
||
33 | /** @var UserRepository */ |
||
34 | private $userRepository; |
||
35 | /** @var TokenStorageInterface */ |
||
36 | private $tokenStorage; |
||
37 | |||
38 | //------------------------------------------------------------------------------------------------------------------ |
||
39 | |||
40 | 4 | public function __construct(UserRepository $userRepository, TokenStorageInterface $tokenStorage) |
|
46 | |||
47 | //------------------------------------------------------------------------------------------------------------------ |
||
48 | |||
49 | 4 | protected function configure(): void |
|
58 | |||
59 | abstract protected function executeBody(InputInterface $input, OutputInterface $output): int; |
||
60 | |||
61 | 6 | protected function execute(InputInterface $input, OutputInterface $output): int |
|
69 | |||
70 | 4 | protected function logInAsSystemMember(): void |
|
88 | |||
89 | //------------------------------------------------------------------------------------------------------------------ |
||
90 | |||
91 | 6 | private function checkAllRequiredOptionsAreNotEmpty(InputInterface $input): void |
|
102 | |||
103 | 6 | private function checkEnvironmentName(InputInterface $input): void |
|
117 | |||
118 | 6 | private function printHeader(InputInterface $input, OutputInterface $output): void |
|
127 | } |
||
128 |