1 | <?php |
||
25 | abstract class AbstractCommand extends Command |
||
26 | { |
||
27 | const FOLDER_RESOURCES = '/../../app/Resources/config/'; |
||
28 | |||
29 | /** |
||
30 | * @var InputInterface |
||
31 | */ |
||
32 | protected $oInput; |
||
33 | |||
34 | /** |
||
35 | * @var OutputInterface |
||
36 | */ |
||
37 | protected $oOutput; |
||
38 | |||
39 | /** |
||
40 | * @var ContainerBuilder |
||
41 | */ |
||
42 | private $oContainer; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | private static $sHomeDir = ''; |
||
48 | |||
49 | /** |
||
50 | * @inheritdoc |
||
51 | */ |
||
52 | 24 | public function __construct($name = null) |
|
65 | |||
66 | /** |
||
67 | * @inheritdoc |
||
68 | */ |
||
69 | 22 | protected function initialize(InputInterface $oInput, OutputInterface $oOutput) |
|
76 | |||
77 | /** |
||
78 | * Executes the current command. |
||
79 | * |
||
80 | * This method is not abstract because you can use this class |
||
81 | * as a concrete class. In this case, instead of defining the |
||
82 | * execute() method, you set the code to execute by passing |
||
83 | * a Closure to the setCode() method. |
||
84 | * |
||
85 | * @param InputInterface $oInput An InputInterface instance |
||
86 | * @param OutputInterface $oOutput An OutputInterface instance |
||
87 | * |
||
88 | * @return integer null or 0 if everything went fine, or an error code |
||
89 | * |
||
90 | * @throws \LogicException When this abstract method is not implemented |
||
91 | * |
||
92 | * @see setCode() |
||
93 | */ |
||
94 | 14 | protected function execute(InputInterface $oInput, OutputInterface $oOutput) |
|
108 | |||
109 | /** |
||
110 | * @return int |
||
111 | */ |
||
112 | abstract protected function process(); |
||
113 | |||
114 | /** |
||
115 | * @return ContainerBuilder |
||
116 | */ |
||
117 | protected function getContainer() |
||
143 | |||
144 | /** |
||
145 | * @return string |
||
146 | */ |
||
147 | 5 | protected function getParameterFileName() |
|
151 | |||
152 | /** |
||
153 | * @return bool |
||
154 | */ |
||
155 | 3 | protected function isAppRunable() |
|
172 | |||
173 | /** |
||
174 | * @return string |
||
175 | */ |
||
176 | 1 | protected function getHomeDir() |
|
193 | |||
194 | /** |
||
195 | * @return string |
||
196 | */ |
||
197 | 1 | protected function getCacheDir() |
|
204 | |||
205 | /** |
||
206 | * @return string |
||
207 | */ |
||
208 | protected function getWorkingDir() |
||
212 | |||
213 | /** |
||
214 | * @param string $sPath |
||
215 | * @param string $sFile |
||
216 | * @param ContainerBuilder $oContainer |
||
217 | */ |
||
218 | private function loadParameterConfig($sPath, $sFile, $oContainer) |
||
227 | |||
228 | /** |
||
229 | * @return string |
||
230 | */ |
||
231 | 4 | protected function getProfileName() |
|
235 | } |
||
236 |