@@ -17,24 +17,24 @@ |
||
17 | 17 | */ |
18 | 18 | class UnregisterCommand extends ModuleCommand |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected function configure() |
|
24 | - { |
|
25 | - parent::configure(); |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected function configure() |
|
24 | + { |
|
25 | + parent::configure(); |
|
26 | 26 | |
27 | - $this->setName('module:unregister') |
|
28 | - ->setDescription('Uninstall module'); |
|
29 | - } |
|
27 | + $this->setName('module:unregister') |
|
28 | + ->setDescription('Uninstall module'); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * {@inheritdoc} |
|
33 | - */ |
|
34 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
35 | - { |
|
36 | - $module = new Module($input->getArgument('module')); |
|
37 | - $module->unRegister(); |
|
38 | - $output->writeln(sprintf('unregistered <info>%s</info>', $module->getName())); |
|
39 | - } |
|
31 | + /** |
|
32 | + * {@inheritdoc} |
|
33 | + */ |
|
34 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
35 | + { |
|
36 | + $module = new Module($input->getArgument('module')); |
|
37 | + $module->unRegister(); |
|
38 | + $output->writeln(sprintf('unregistered <info>%s</info>', $module->getName())); |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -19,38 +19,38 @@ |
||
19 | 19 | */ |
20 | 20 | class UpdateCommand extends ModuleCommand |
21 | 21 | { |
22 | - use CanRestartTrait; |
|
22 | + use CanRestartTrait; |
|
23 | 23 | |
24 | - /** |
|
25 | - * {@inheritdoc} |
|
26 | - */ |
|
27 | - protected function configure() |
|
28 | - { |
|
29 | - parent::configure(); |
|
24 | + /** |
|
25 | + * {@inheritdoc} |
|
26 | + */ |
|
27 | + protected function configure() |
|
28 | + { |
|
29 | + parent::configure(); |
|
30 | 30 | |
31 | - $this->setName('module:update') |
|
32 | - ->setDescription('Load module updates from Marketplace') |
|
33 | - ->addOption('beta', 'b', InputOption::VALUE_NONE, 'Allow the installation of beta releases'); |
|
34 | - } |
|
31 | + $this->setName('module:update') |
|
32 | + ->setDescription('Load module updates from Marketplace') |
|
33 | + ->addOption('beta', 'b', InputOption::VALUE_NONE, 'Allow the installation of beta releases'); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * {@inheritdoc} |
|
38 | - */ |
|
39 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
40 | - { |
|
41 | - $module = new Module($input->getArgument('module')); |
|
42 | - $modulesUpdated = null; |
|
43 | - while ($module->update($modulesUpdated)) |
|
44 | - { |
|
45 | - if (is_array($modulesUpdated)) |
|
46 | - { |
|
47 | - foreach ($modulesUpdated as $moduleName => $moduleVersion) |
|
48 | - { |
|
49 | - $output->writeln(sprintf('updated %s to <info>%s</info>', $moduleName, $moduleVersion)); |
|
50 | - } |
|
51 | - } |
|
52 | - return $this->restartScript($input, $output); |
|
53 | - } |
|
54 | - return 0; |
|
55 | - } |
|
36 | + /** |
|
37 | + * {@inheritdoc} |
|
38 | + */ |
|
39 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
40 | + { |
|
41 | + $module = new Module($input->getArgument('module')); |
|
42 | + $modulesUpdated = null; |
|
43 | + while ($module->update($modulesUpdated)) |
|
44 | + { |
|
45 | + if (is_array($modulesUpdated)) |
|
46 | + { |
|
47 | + foreach ($modulesUpdated as $moduleName => $moduleVersion) |
|
48 | + { |
|
49 | + $output->writeln(sprintf('updated %s to <info>%s</info>', $moduleName, $moduleVersion)); |
|
50 | + } |
|
51 | + } |
|
52 | + return $this->restartScript($input, $output); |
|
53 | + } |
|
54 | + return 0; |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | \ No newline at end of file |
@@ -17,24 +17,24 @@ |
||
17 | 17 | */ |
18 | 18 | class RemoveCommand extends ModuleCommand |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected function configure() |
|
24 | - { |
|
25 | - parent::configure(); |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected function configure() |
|
24 | + { |
|
25 | + parent::configure(); |
|
26 | 26 | |
27 | - $this->setName('module:remove') |
|
28 | - ->setDescription('Uninstall and remove module folder from system'); |
|
29 | - } |
|
27 | + $this->setName('module:remove') |
|
28 | + ->setDescription('Uninstall and remove module folder from system'); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * {@inheritdoc} |
|
33 | - */ |
|
34 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
35 | - { |
|
36 | - $module = new Module($input->getArgument('module')); |
|
37 | - $module->remove(); |
|
38 | - $output->writeln(sprintf('removed <info>%s</info>', $module->getName())); |
|
39 | - } |
|
31 | + /** |
|
32 | + * {@inheritdoc} |
|
33 | + */ |
|
34 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
35 | + { |
|
36 | + $module = new Module($input->getArgument('module')); |
|
37 | + $module->remove(); |
|
38 | + $output->writeln(sprintf('removed <info>%s</info>', $module->getName())); |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -21,48 +21,48 @@ |
||
21 | 21 | */ |
22 | 22 | abstract class ModuleCommand extends BitrixCommand |
23 | 23 | { |
24 | - /** |
|
25 | - * {@inheritdoc} |
|
26 | - */ |
|
27 | - protected function configure() |
|
28 | - { |
|
29 | - parent::configure(); |
|
24 | + /** |
|
25 | + * {@inheritdoc} |
|
26 | + */ |
|
27 | + protected function configure() |
|
28 | + { |
|
29 | + parent::configure(); |
|
30 | 30 | |
31 | - $this->addArgument('module', InputArgument::REQUIRED, 'Module name (e.g. `vendor.module`)') |
|
32 | - ->addOption('confirm-thirdparty', 'ct', InputOption::VALUE_NONE, 'Suppress third-party modules warning'); |
|
33 | - } |
|
31 | + $this->addArgument('module', InputArgument::REQUIRED, 'Module name (e.g. `vendor.module`)') |
|
32 | + ->addOption('confirm-thirdparty', 'ct', InputOption::VALUE_NONE, 'Suppress third-party modules warning'); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @inheritdoc |
|
37 | - */ |
|
38 | - protected function interact(InputInterface $input, OutputInterface $output) |
|
39 | - { |
|
40 | - parent::interact($input, $output); |
|
35 | + /** |
|
36 | + * @inheritdoc |
|
37 | + */ |
|
38 | + protected function interact(InputInterface $input, OutputInterface $output) |
|
39 | + { |
|
40 | + parent::interact($input, $output); |
|
41 | 41 | |
42 | - $module = new Module($input->getArgument('module')); |
|
42 | + $module = new Module($input->getArgument('module')); |
|
43 | 43 | |
44 | - if (in_array($this->getName(), ['module:register', 'module:unregister']) |
|
45 | - && $module->isThirdParty() && !$input->getOption('confirm-thirdparty') |
|
46 | - ) |
|
47 | - { |
|
48 | - $output->writeln($module->isThirdParty() . ' is not a kernel module. Correct operation cannot be guaranteed for third-party modules!'); |
|
49 | - } |
|
50 | - } |
|
44 | + if (in_array($this->getName(), ['module:register', 'module:unregister']) |
|
45 | + && $module->isThirdParty() && !$input->getOption('confirm-thirdparty') |
|
46 | + ) |
|
47 | + { |
|
48 | + $output->writeln($module->isThirdParty() . ' is not a kernel module. Correct operation cannot be guaranteed for third-party modules!'); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Gets console commands from this package. |
|
54 | - * |
|
55 | - * @return Command[] |
|
56 | - */ |
|
57 | - public static function getCommands() |
|
58 | - { |
|
59 | - return [ |
|
60 | - new LoadCommand(), |
|
61 | - new RegisterCommand(), |
|
62 | - new RemoveCommand(), |
|
63 | - new UnregisterCommand(), |
|
64 | - new UpdateCommand(), |
|
65 | - ]; |
|
66 | - } |
|
52 | + /** |
|
53 | + * Gets console commands from this package. |
|
54 | + * |
|
55 | + * @return Command[] |
|
56 | + */ |
|
57 | + public static function getCommands() |
|
58 | + { |
|
59 | + return [ |
|
60 | + new LoadCommand(), |
|
61 | + new RegisterCommand(), |
|
62 | + new RemoveCommand(), |
|
63 | + new UnregisterCommand(), |
|
64 | + new UpdateCommand(), |
|
65 | + ]; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | \ No newline at end of file |
@@ -45,7 +45,7 @@ |
||
45 | 45 | && $module->isThirdParty() && !$input->getOption('confirm-thirdparty') |
46 | 46 | ) |
47 | 47 | { |
48 | - $output->writeln($module->isThirdParty() . ' is not a kernel module. Correct operation cannot be guaranteed for third-party modules!'); |
|
48 | + $output->writeln($module->isThirdParty().' is not a kernel module. Correct operation cannot be guaranteed for third-party modules!'); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | protected function restartScript(InputInterface $input, OutputInterface $output) |
33 | 33 | { |
34 | - $proc = popen('php -f ' . join(' ', $GLOBALS['argv']) . ' 2>&1', 'r'); |
|
34 | + $proc = popen('php -f '.join(' ', $GLOBALS['argv']).' 2>&1', 'r'); |
|
35 | 35 | while (!feof($proc)) |
36 | 36 | { |
37 | 37 | $output->write(fread($proc, 4096)); |
@@ -39,11 +39,11 @@ |
||
39 | 39 | throw new ArgumentTypeException('callChain', 'array'); |
40 | 40 | } |
41 | 41 | |
42 | - $chain .= '->' . $method . '(' . static::convertArgsToString($methodArgs) . ')'; |
|
42 | + $chain .= '->'.$method.'('.static::convertArgsToString($methodArgs).')'; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | - return '\\' . $className . '::agent(' . static::convertArgsToString($args). ')' . $chain . ';'; |
|
46 | + return '\\'.$className.'::agent('.static::convertArgsToString($args).')'.$chain.';'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | protected static function convertArgsToString(array $args) |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function initialize(InputInterface $input, OutputInterface $output) |
86 | 86 | { |
87 | - $this->tmplDir = __DIR__ . '/../../../tmpl'; |
|
87 | + $this->tmplDir = __DIR__.'/../../../tmpl'; |
|
88 | 88 | $this->questionHelper = $this->getHelper('question'); |
89 | 89 | |
90 | 90 | parent::initialize($input, $output); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $this->createEnvironmentsDir($input, $output); |
101 | 101 | $this->createConfiguration($input, $output); |
102 | 102 | |
103 | - $output->writeln('<info>' . static::COMPLETED_LOGO . '</info>'); |
|
103 | + $output->writeln('<info>'.static::COMPLETED_LOGO.'</info>'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | */ |
112 | 112 | protected function createEnvironmentsDir(InputInterface $input, OutputInterface $output) |
113 | 113 | { |
114 | - $targetDir = getcwd() . '/' . $this->envDir; |
|
115 | - $tmplDir = $this->tmplDir . '/environments'; |
|
114 | + $targetDir = getcwd().'/'.$this->envDir; |
|
115 | + $tmplDir = $this->tmplDir.'/environments'; |
|
116 | 116 | |
117 | 117 | $output->writeln(' - Environment settings'); |
118 | 118 | |
119 | 119 | if (file_exists($targetDir)) |
120 | 120 | { |
121 | 121 | $question = new ConfirmationQuestion( |
122 | - ' <error>Directory ' . $targetDir . ' already exists</error>' . PHP_EOL |
|
122 | + ' <error>Directory '.$targetDir.' already exists</error>'.PHP_EOL |
|
123 | 123 | . ' <info>Overwrite? [Y/n]</info> ', |
124 | 124 | true, |
125 | 125 | '/^(y|j)/i' |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | foreach ($iterator as $item) |
139 | 139 | { |
140 | - $itemPath = $targetDir . '/' . $iterator->getSubPathName(); |
|
140 | + $itemPath = $targetDir.'/'.$iterator->getSubPathName(); |
|
141 | 141 | |
142 | 142 | if ($item->isDir()) |
143 | 143 | { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - $output->writeln(' Created directory settings of environments: <comment>' . $targetDir . '</comment>'); |
|
152 | + $output->writeln(' Created directory settings of environments: <comment>'.$targetDir.'</comment>'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | */ |
161 | 161 | protected function createConfiguration(InputInterface $input, OutputInterface $output) |
162 | 162 | { |
163 | - $path = $this->getApplication()->getRoot() . '/.jedi.php'; |
|
163 | + $path = $this->getApplication()->getRoot().'/.jedi.php'; |
|
164 | 164 | |
165 | 165 | $output->writeln(' - Configuration'); |
166 | 166 | |
167 | 167 | if (file_exists($path)) |
168 | 168 | { |
169 | 169 | $question = new ConfirmationQuestion( |
170 | - ' <error>Configuration file ' . $path . ' already exists</error>' . PHP_EOL |
|
170 | + ' <error>Configuration file '.$path.' already exists</error>'.PHP_EOL |
|
171 | 171 | . ' <info>Overwrite? [Y/n]</info> ', |
172 | 172 | true, |
173 | 173 | '/^(y|j)/i' |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | $fs = new Filesystem(); |
183 | 183 | |
184 | 184 | $question = new Question(' <info>Enter path to web directory relative to ' |
185 | - . $this->getApplication()->getRoot(). ':</info> ' . PHP_EOL |
|
186 | - . ' (or do not specify if you are already in the web directory)' . PHP_EOL); |
|
185 | + . $this->getApplication()->getRoot().':</info> '.PHP_EOL |
|
186 | + . ' (or do not specify if you are already in the web directory)'.PHP_EOL); |
|
187 | 187 | |
188 | - $question->setValidator(function ($answer) use ($fs) { |
|
188 | + $question->setValidator(function($answer) use ($fs) { |
|
189 | 189 | $path = $answer; |
190 | 190 | |
191 | 191 | if ($answer === null) |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | } |
195 | 195 | elseif (!$fs->isAbsolutePath($answer)) |
196 | 196 | { |
197 | - $path = $this->getApplication()->getRoot() . '/' . $answer; |
|
197 | + $path = $this->getApplication()->getRoot().'/'.$answer; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | if (!is_dir($path)) |
201 | 201 | { |
202 | - throw new \RuntimeException('Directory "' . $path . '" is missing'); |
|
202 | + throw new \RuntimeException('Directory "'.$path.'" is missing'); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return $answer; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | $webDir = $this->questionHelper->ask($input, $output, $question); |
209 | 209 | |
210 | - $content = file_get_contents($this->tmplDir . '/.jedi.php'); |
|
210 | + $content = file_get_contents($this->tmplDir.'/.jedi.php'); |
|
211 | 211 | $content = str_replace( |
212 | 212 | ['%web-dir%', '%env-dir%'], |
213 | 213 | [addslashes($webDir), addslashes($this->envDir)], |
@@ -215,6 +215,6 @@ discard block |
||
215 | 215 | ); |
216 | 216 | $fs->dumpFile($path, $content); |
217 | 217 | |
218 | - $output->writeln(' Created configuration file of application <comment>' . $path . '</comment>'); |
|
218 | + $output->writeln(' Created configuration file of application <comment>'.$path.'</comment>'); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | \ No newline at end of file |
@@ -142,8 +142,7 @@ discard block |
||
142 | 142 | if ($item->isDir()) |
143 | 143 | { |
144 | 144 | $fs->mkdir($itemPath); |
145 | - } |
|
146 | - else |
|
145 | + } else |
|
147 | 146 | { |
148 | 147 | $fs->copy($item, $itemPath, true); |
149 | 148 | } |
@@ -191,8 +190,7 @@ discard block |
||
191 | 190 | if ($answer === null) |
192 | 191 | { |
193 | 192 | $path = $this->getApplication()->getRoot(); |
194 | - } |
|
195 | - elseif (!$fs->isAbsolutePath($answer)) |
|
193 | + } elseif (!$fs->isAbsolutePath($answer)) |
|
196 | 194 | { |
197 | 195 | $path = $this->getApplication()->getRoot() . '/' . $answer; |
198 | 196 | } |