1 | <?php |
||
23 | class PHPDepsApplication implements ApplicationInterface |
||
24 | { |
||
25 | const VERSION = 'v0.1.0'; |
||
26 | |||
27 | /** @var bool */ |
||
28 | private $running; |
||
29 | |||
30 | /** @var ContainerInterface */ |
||
31 | private $container; |
||
32 | |||
33 | /** @var ConsoleKernel */ |
||
34 | private $consoleKernel; |
||
35 | |||
36 | public function __construct(ContainerInterface $container, ConsoleKernel $consoleKernel) |
||
42 | |||
43 | /** |
||
44 | * @throws ContainerExceptionInterface |
||
45 | * @throws Exception |
||
46 | * @throws NotFoundExceptionInterface |
||
47 | */ |
||
48 | public function run() |
||
64 | |||
65 | public function getName() |
||
69 | |||
70 | public function isRunning() |
||
74 | |||
75 | /** |
||
76 | * @return string[] |
||
77 | */ |
||
78 | public function getCommandsList() |
||
87 | |||
88 | /** |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getDefaultCommand() |
||
95 | |||
96 | protected function initialize() |
||
102 | |||
103 | /** |
||
104 | * @throws ContainerExceptionInterface |
||
105 | * @throws NotFoundExceptionInterface |
||
106 | */ |
||
107 | protected function loadCommands() |
||
115 | |||
116 | /** |
||
117 | * @throws ContainerExceptionInterface |
||
118 | * @throws NotFoundExceptionInterface |
||
119 | * @throws Exception |
||
120 | * |
||
121 | * @return int Exit code |
||
122 | */ |
||
123 | protected function executeCommand() |
||
130 | } |
||
131 |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.