| Total Complexity | 6 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class Bootstrap |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var MvcApplication |
||
| 15 | */ |
||
| 16 | private $mvcApp; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Bootstrap constructor. |
||
| 20 | * @param array $configuration |
||
| 21 | */ |
||
| 22 | public function __construct(array $configuration) |
||
| 23 | { |
||
| 24 | $this->mvcApp = MvcApplication::init($configuration); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return ConsoleApplication |
||
| 29 | * @throws \Zend\Console\Exception\RuntimeException |
||
| 30 | * @throws \Zend\Console\Exception\InvalidArgumentException |
||
| 31 | */ |
||
| 32 | public function setupConsoleApp(): ConsoleApplication |
||
| 33 | { |
||
| 34 | $services = $this->mvcApp->getServiceManager(); |
||
| 35 | |||
| 36 | $version = $services->get('Config')['version']; |
||
| 37 | |||
| 38 | $application = new ConsoleApplication( |
||
| 39 | 'TogglJira', |
||
| 40 | $version, |
||
| 41 | $this->readRoutesFromMvc(), |
||
| 42 | Console::getInstance(), |
||
| 43 | new Dispatcher($services) |
||
| 44 | ); |
||
| 45 | |||
| 46 | $application->getExceptionHandler()->setMessageTemplate( |
||
| 47 | file_get_contents($this->locateExceptionHandlerTemplate()) |
||
| 48 | ); |
||
| 49 | |||
| 50 | return $application; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return array |
||
| 55 | */ |
||
| 56 | private function readRoutesFromMvc(): array |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | private function locateExceptionHandlerTemplate(): string |
||
| 67 | } |
||
| 68 | } |
||
| 69 |