1 | <?php |
||
27 | abstract class AbstractCommand extends Command |
||
28 | { |
||
29 | const FOLDER_RESOURCES = '/../../app/Resources/config/'; |
||
30 | |||
31 | /** |
||
32 | * @var InputInterface |
||
33 | */ |
||
34 | protected $oInput; |
||
35 | |||
36 | /** |
||
37 | * @var OutputInterface |
||
38 | */ |
||
39 | protected $oOutput; |
||
40 | |||
41 | /** |
||
42 | * @var ContainerBuilder |
||
43 | */ |
||
44 | private $oContainer; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | private static $sHomeDir = ''; |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | 24 | public function __construct($name = null) |
|
67 | |||
68 | /** |
||
69 | * @inheritdoc |
||
70 | */ |
||
71 | 22 | protected function initialize(InputInterface $oInput, OutputInterface $oOutput) |
|
78 | |||
79 | /** |
||
80 | * Executes the current command. |
||
81 | * |
||
82 | * This method is not abstract because you can use this class |
||
83 | * as a concrete class. In this case, instead of defining the |
||
84 | * execute() method, you set the code to execute by passing |
||
85 | * a Closure to the setCode() method. |
||
86 | * |
||
87 | * @param InputInterface $oInput An InputInterface instance |
||
88 | * @param OutputInterface $oOutput An OutputInterface instance |
||
89 | * |
||
90 | * @return integer null or 0 if everything went fine, or an error code |
||
91 | * |
||
92 | * @throws \LogicException When this abstract method is not implemented |
||
93 | * |
||
94 | * @see setCode() |
||
95 | */ |
||
96 | 14 | protected function execute(InputInterface $oInput, OutputInterface $oOutput) |
|
110 | |||
111 | /** |
||
112 | * @return int |
||
113 | */ |
||
114 | abstract protected function process(); |
||
115 | |||
116 | /** |
||
117 | * @return ContainerBuilder |
||
118 | */ |
||
119 | protected function getContainer() |
||
134 | |||
135 | /** |
||
136 | * @return string |
||
137 | */ |
||
138 | 5 | protected function getParameterFileName() |
|
142 | |||
143 | /** |
||
144 | * @return bool |
||
145 | */ |
||
146 | 3 | protected function isAppRunable() |
|
163 | |||
164 | /** |
||
165 | * @return string |
||
166 | */ |
||
167 | 1 | protected function getHomeDir() |
|
184 | |||
185 | /** |
||
186 | * @return string |
||
187 | */ |
||
188 | 1 | protected function getCacheDir() |
|
195 | |||
196 | /** |
||
197 | * @return string |
||
198 | */ |
||
199 | protected function getWorkingDir() |
||
203 | |||
204 | /** |
||
205 | * @return string |
||
206 | */ |
||
207 | 4 | protected function getProfileName() |
|
211 | |||
212 | /** |
||
213 | * @return ContainerBuilder |
||
214 | */ |
||
215 | private function loadContainer() |
||
234 | } |
||
235 |