| Total Complexity | 4 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | class AbstractCommand extends Command |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var string $path Bot path |
||
| 23 | */ |
||
| 24 | protected $path; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var ClientInterface |
||
| 28 | */ |
||
| 29 | protected $client; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var ContainerInterface |
||
| 33 | */ |
||
| 34 | protected $config; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param string $path |
||
| 38 | */ |
||
| 39 | protected function init(string $path) |
||
| 40 | { |
||
| 41 | $rPath = realpath($path); |
||
| 42 | |||
| 43 | if (!is_dir($rPath) || !is_readable($rPath)) { |
||
| 44 | throw new RuntimeException(sprintf('Bot directory with absolute path "%s" does not exist or not readable.', $path)); |
||
| 45 | } |
||
| 46 | |||
| 47 | $configLoader = new ConfigLoader($rPath); |
||
| 48 | $this->config = $configLoader->load(); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Executes command |
||
| 53 | * |
||
| 54 | * @param InputInterface $input |
||
| 55 | * @param OutputInterface $output |
||
| 56 | */ |
||
| 57 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 62 | } |
||
| 63 | } |
||
| 64 |