1 | <?php |
||
24 | abstract class AbstractCommand extends Command |
||
25 | { |
||
26 | const FOLDER_RESOURCES = '/../../app/Resources/config/'; |
||
27 | |||
28 | /** |
||
29 | * @var InputInterface |
||
30 | */ |
||
31 | protected $oInput; |
||
32 | |||
33 | /** |
||
34 | * @var OutputInterface |
||
35 | */ |
||
36 | protected $oOutput; |
||
37 | |||
38 | /** |
||
39 | * @var ContainerBuilder |
||
40 | */ |
||
41 | private $oContainer; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private static $sHomeDir = ''; |
||
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | 25 | public function __construct($name = null) |
|
64 | |||
65 | /** |
||
66 | * @inheritdoc |
||
67 | */ |
||
68 | 23 | protected function initialize(InputInterface $oInput, OutputInterface $oOutput) |
|
75 | |||
76 | /** |
||
77 | * Executes the current command. |
||
78 | * |
||
79 | * This method is not abstract because you can use this class |
||
80 | * as a concrete class. In this case, instead of defining the |
||
81 | * execute() method, you set the code to execute by passing |
||
82 | * a Closure to the setCode() method. |
||
83 | * |
||
84 | * @param InputInterface $oInput An InputInterface instance |
||
85 | * @param OutputInterface $oOutput An OutputInterface instance |
||
86 | * |
||
87 | * @return integer null or 0 if everything went fine, or an error code |
||
88 | * |
||
89 | * @throws \LogicException When this abstract method is not implemented |
||
90 | * |
||
91 | * @see setCode() |
||
92 | */ |
||
93 | 14 | protected function execute(InputInterface $oInput, OutputInterface $oOutput) |
|
107 | |||
108 | /** |
||
109 | * @return int |
||
110 | */ |
||
111 | abstract protected function process(); |
||
112 | |||
113 | /** |
||
114 | * @return ContainerBuilder |
||
115 | */ |
||
116 | protected function getContainer() |
||
137 | |||
138 | /** |
||
139 | * @return string |
||
140 | */ |
||
141 | 9 | protected function getParameterFileName() |
|
145 | |||
146 | /** |
||
147 | * @return bool |
||
148 | */ |
||
149 | 3 | protected function isAppRunable() |
|
166 | |||
167 | /** |
||
168 | * @return string |
||
169 | */ |
||
170 | 1 | protected function getHomeDir() |
|
187 | |||
188 | /** |
||
189 | * @return string |
||
190 | */ |
||
191 | 1 | protected function getCacheDir() |
|
198 | |||
199 | /** |
||
200 | * @return string |
||
201 | */ |
||
202 | protected function getWorkingDir() |
||
206 | |||
207 | /** |
||
208 | * @param string $sPath |
||
209 | * @param string $sFile |
||
210 | * @param ContainerBuilder $oContainer |
||
211 | */ |
||
212 | private function loadParameterConfig($sPath, $sFile, $oContainer) |
||
221 | |||
222 | /** |
||
223 | * @return string |
||
224 | */ |
||
225 | 4 | protected function getProfileName() |
|
229 | } |
||
230 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.