1 | <?php |
||
24 | class Application extends BaseApplication |
||
25 | { |
||
26 | /** |
||
27 | * name |
||
28 | * |
||
29 | * @const NAME |
||
30 | */ |
||
31 | const NAME = 'CLIFramework'; |
||
32 | |||
33 | /** |
||
34 | * version |
||
35 | * |
||
36 | * @const VERSION |
||
37 | */ |
||
38 | const VERSION = '0.0.1-dev'; |
||
39 | |||
40 | /** |
||
41 | * The kernel. |
||
42 | * |
||
43 | * @var \Symfony\Component\HttpKernel\KernelInterface $kernel |
||
44 | */ |
||
45 | private $kernel; |
||
46 | |||
47 | /** |
||
48 | * The container. |
||
49 | * |
||
50 | * @var \Symfony\Component\DependencyInjection\ContainerInterface $container |
||
51 | */ |
||
52 | private $container; |
||
53 | |||
54 | /** |
||
55 | * Construct the application. |
||
56 | * |
||
57 | * @param \Symfony\Component\HttpKernel\KernelInterface $kernel |
||
58 | */ |
||
59 | 4 | public function __construct(KernelInterface $kernel) |
|
60 | { |
||
61 | 4 | $this->kernel = $kernel; |
|
62 | 4 | $this->container = $kernel->getContainer(); |
|
63 | |||
64 | 4 | parent::__construct(self::NAME, self::VERSION); |
|
65 | |||
66 | 4 | if ($this->container->has('event_dispatcher')) { |
|
67 | 3 | $this->setDispatcher($this->container->get('event_dispatcher')); |
|
68 | 3 | } |
|
69 | |||
70 | 4 | $this->getDefinition()->addOption( |
|
71 | 4 | new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev') |
|
72 | 4 | ); |
|
73 | 4 | $this->getDefinition()->addOption( |
|
74 | 4 | new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.') |
|
75 | 4 | ); |
|
76 | 4 | } |
|
77 | |||
78 | /** |
||
79 | * Get kernel. |
||
80 | * |
||
81 | * @return \Symfony\Component\HttpKernel\KernelInterface |
||
82 | */ |
||
83 | 1 | public function getKernel() |
|
87 | |||
88 | /** |
||
89 | * Runs the current application. |
||
90 | * |
||
91 | * @param \Symfony\Component\Console\Input\InputInterface $input |
||
92 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
93 | * |
||
94 | * @return int |
||
95 | */ |
||
96 | 2 | public function doRun(InputInterface $input, OutputInterface $output) |
|
111 | |||
112 | /** |
||
113 | * Register commands into the application |
||
114 | * |
||
115 | * @return void |
||
116 | */ |
||
117 | 2 | protected function registerCommands() |
|
125 | } |
||
126 |