@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | * @param string $type ~ seed or revert |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public function getSeedKey($type='seed') |
|
240 | + public function getSeedKey($type = 'seed') |
|
241 | 241 | { |
242 | 242 | $key = $this->blender->getSeedKeyFromName($this->getFieldNamespace().'-'.$this->getFieldName()); |
243 | 243 | |
244 | 244 | switch ($type) { |
245 | 245 | case 'revert': |
246 | - $seed_key = 'revert-' . $key; |
|
246 | + $seed_key = 'revert-'.$key; |
|
247 | 247 | break; |
248 | 248 | |
249 | 249 | case 'seed': |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | /** |
351 | 351 | * @param bool $load_defaults |
352 | 352 | */ |
353 | - protected function loadObject($load_defaults=false) |
|
353 | + protected function loadObject($load_defaults = false) |
|
354 | 354 | { |
355 | 355 | parent::loadObject(); |
356 | 356 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param int $property_set |
41 | 41 | * @return $this |
42 | 42 | */ |
43 | - public function attachOnEvent($event_name, $priority=0, $property_set=0) |
|
43 | + public function attachOnEvent($event_name, $priority = 0, $property_set = 0) |
|
44 | 44 | { |
45 | 45 | $this->related_data[] = [ |
46 | 46 | 'event' => $event_name, |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * @var string $type blend or revert |
139 | 139 | */ |
140 | - protected function seedRelated($type='blend') |
|
140 | + protected function seedRelated($type = 'blend') |
|
141 | 141 | { |
142 | 142 | // get all related Events: |
143 | 143 | $events = []; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * DownloadModxVersion constructor. |
57 | 57 | * @param null|OutputInterface $output |
58 | 58 | */ |
59 | - public function __construct($output=null) |
|
59 | + public function __construct($output = null) |
|
60 | 60 | { |
61 | 61 | $this->output = $output; |
62 | 62 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string $branch |
108 | 108 | * @return bool |
109 | 109 | */ |
110 | - public function getGitBranch($branch='3.x') |
|
110 | + public function getGitBranch($branch = '3.x') |
|
111 | 111 | { |
112 | 112 | $this->git_project_version = $branch; |
113 | 113 | $this->loadGuzzle(); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param string $release |
126 | 126 | * @return bool |
127 | 127 | */ |
128 | - public function getGitRelease($release='v2.6.1-pl') |
|
128 | + public function getGitRelease($release = 'v2.6.1-pl') |
|
129 | 129 | { |
130 | 130 | $this->git_project_version = ltrim($release, 'v'); |
131 | 131 | $this->loadGuzzle(); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // Base URI is used with relative requests |
166 | 166 | 'base_uri' => 'https://github.com/modxcms/revolution/archive/', |
167 | 167 | // You can set any number of default request options. |
168 | - 'timeout' => 300.0,// for slow internet |
|
168 | + 'timeout' => 300.0, // for slow internet |
|
169 | 169 | ]); |
170 | 170 | } |
171 | 171 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @param bool $remove_build |
176 | 176 | * @return bool |
177 | 177 | */ |
178 | - protected function moveGitFiles($run_composer_update=true, $remove_setup=true, $remove_build=true) |
|
178 | + protected function moveGitFiles($run_composer_update = true, $remove_setup = true, $remove_build = true) |
|
179 | 179 | { |
180 | 180 | // unzip into proper directory: |
181 | 181 | $zip = new ZipArchive; |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | $file_count = $zip->numFiles; |
184 | 184 | |
185 | 185 | if ($this->output instanceof OutputInterface) { |
186 | - $this->output->writeln('Extracting '.$this->zip_file. ' to '.BLEND_CACHE_DIR.' File count: '.$file_count); |
|
186 | + $this->output->writeln('Extracting '.$this->zip_file.' to '.BLEND_CACHE_DIR.' File count: '.$file_count); |
|
187 | 187 | $progress = new ProgressBar($this->output, $file_count); |
188 | 188 | $progress->start(); |
189 | 189 | |
190 | 190 | $progress->setRedrawFrequency(10); |
191 | 191 | } |
192 | 192 | |
193 | - for($i = 0; $i < $zip->numFiles; $i++) { |
|
193 | + for ($i = 0; $i < $zip->numFiles; $i++) { |
|
194 | 194 | $zip->extractTo(BLEND_CACHE_DIR, [$zip->getNameIndex($i)]); |
195 | 195 | |
196 | 196 | if (isset($progress) && $progress instanceof ProgressBar) { |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | |
211 | 211 | if ($remove_build) { |
212 | 212 | // delete the _build: |
213 | - $this->deleteDirectory(MODX_PATH . '_build'); |
|
213 | + $this->deleteDirectory(MODX_PATH.'_build'); |
|
214 | 214 | } |
215 | 215 | if ($remove_setup) { |
216 | 216 | // delete the setup: |
217 | - $this->deleteDirectory(MODX_PATH . 'setup'); |
|
217 | + $this->deleteDirectory(MODX_PATH.'setup'); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // run composer update: |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | } else { |
228 | 228 | // error |
229 | - $this->output->writeln('<error>Error Extracting '.$this->zip_file. ' to '.BLEND_CACHE_DIR.'</error>'); |
|
229 | + $this->output->writeln('<error>Error Extracting '.$this->zip_file.' to '.BLEND_CACHE_DIR.'</error>'); |
|
230 | 230 | } |
231 | 231 | return false; |
232 | 232 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | /** |
235 | 235 | * @param int $file_count ~ count of files in the directory |
236 | 236 | */ |
237 | - protected function copyExtractedDirectory($file_count=4000) |
|
237 | + protected function copyExtractedDirectory($file_count = 4000) |
|
238 | 238 | { |
239 | 239 | $source = BLEND_CACHE_DIR.'revolution-'.$this->git_project_version; |
240 | 240 | $destination = MODX_PATH; |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | { |
250 | 250 | // Composer\Factory::getHomeDir() method |
251 | 251 | // needs COMPOSER_HOME environment variable set |
252 | - putenv('COMPOSER_HOME=' . MODX_PATH . 'vendor/bin/composer'); |
|
252 | + putenv('COMPOSER_HOME='.MODX_PATH.'vendor/bin/composer'); |
|
253 | 253 | putenv('COMPOSER='.MODX_PATH.'composer.json'); |
254 | 254 | |
255 | 255 | $output = new ConsoleOutput(); |
256 | - $output->writeln('Run: composer install: COMPOSER='.MODX_PATH.'composer.json'.PHP_EOL.'COMPOSER_HOME=' . MODX_PATH . 'vendor/bin/composer'); |
|
256 | + $output->writeln('Run: composer install: COMPOSER='.MODX_PATH.'composer.json'.PHP_EOL.'COMPOSER_HOME='.MODX_PATH.'vendor/bin/composer'); |
|
257 | 257 | |
258 | 258 | try { |
259 | 259 | //ini_set('memory_limit', '1024M'); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param string $destination ~ full path of destination |
22 | 22 | * @param int $file_count |
23 | 23 | */ |
24 | - public function copyDirectory($source, $destination, $file_count=4000) |
|
24 | + public function copyDirectory($source, $destination, $file_count = 4000) |
|
25 | 25 | { |
26 | 26 | if (!is_dir($destination)) { |
27 | 27 | mkdir($destination, 0700); |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | /** @var \DirectoryIterator $item */ |
45 | 45 | foreach ($recursiveIteratorIterator as $item) { |
46 | 46 | if ($item->isDir()) { |
47 | - if (is_dir($destination. DIRECTORY_SEPARATOR. $recursiveIteratorIterator->getSubPathName())) { |
|
47 | + if (is_dir($destination.DIRECTORY_SEPARATOR.$recursiveIteratorIterator->getSubPathName())) { |
|
48 | 48 | continue; |
49 | 49 | } |
50 | - mkdir($destination . DIRECTORY_SEPARATOR . $recursiveIteratorIterator->getSubPathName()); |
|
50 | + mkdir($destination.DIRECTORY_SEPARATOR.$recursiveIteratorIterator->getSubPathName()); |
|
51 | 51 | |
52 | 52 | } else { |
53 | - copy($item, $destination . DIRECTORY_SEPARATOR . $recursiveIteratorIterator->getSubPathName()); |
|
53 | + copy($item, $destination.DIRECTORY_SEPARATOR.$recursiveIteratorIterator->getSubPathName()); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if (isset($progress) && $progress instanceof ProgressBar) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...] |
40 | 40 | * @return mixed ~ selected value |
41 | 41 | */ |
42 | - public function promptSelectOneOption(string $question, $default, $options=[]); |
|
42 | + public function promptSelectOneOption(string $question, $default, $options = []); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * @param string $question |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...] |
48 | 48 | * @return array ~ array of selected values |
49 | 49 | */ |
50 | - public function promptSelectMultipleOptions(string $question, $default, $options=[]); |
|
50 | + public function promptSelectMultipleOptions(string $question, $default, $options = []); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @param string $question |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param bool $default |
31 | 31 | * @return bool |
32 | 32 | */ |
33 | - public function promptConfirm(string $question, $default=true) |
|
33 | + public function promptConfirm(string $question, $default = true) |
|
34 | 34 | { |
35 | 35 | return $default; |
36 | 36 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $error_message ~ ex: 'Color %s is invalid.' |
53 | 53 | * @return mixed ~ selected value |
54 | 54 | */ |
55 | - public function promptSelectOneOption(string $question, $default, $options=[], $error_message='%s is an invalid choice.') |
|
55 | + public function promptSelectOneOption(string $question, $default, $options = [], $error_message = '%s is an invalid choice.') |
|
56 | 56 | { |
57 | 57 | return $default; |
58 | 58 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param string $error_message ~ ex: 'Color %s is invalid.' |
65 | 65 | * @return array ~ array of selected values |
66 | 66 | */ |
67 | - public function promptSelectMultipleOptions(string $question, $default, $options=[], $error_message='%s is an invalid choice.') |
|
67 | + public function promptSelectMultipleOptions(string $question, $default, $options = [], $error_message = '%s is an invalid choice.') |
|
68 | 68 | { |
69 | 69 | return $default; |
70 | 70 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param string $key |
35 | 35 | * @return bool|mixed |
36 | 36 | */ |
37 | - public function get($key='install-config') |
|
37 | + public function get($key = 'install-config') |
|
38 | 38 | { |
39 | 39 | $path = $this->getFullKeyPath($key); |
40 | 40 | $data = false; |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * @param string $key |
51 | 51 | * @param array $data |
52 | 52 | */ |
53 | - public function set($key='install-config', $data=[]) |
|
53 | + public function set($key = 'install-config', $data = []) |
|
54 | 54 | { |
55 | 55 | $content = '<?php '.PHP_EOL. |
56 | - 'return ' . var_export($data, true) . ';'; |
|
56 | + 'return '.var_export($data, true).';'; |
|
57 | 57 | |
58 | 58 | file_put_contents($this->getFullKeyPath($key), $content); |
59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * @param null|string $key ~ if null will delete the complete directory |
63 | 63 | */ |
64 | - public function remove($key=null) |
|
64 | + public function remove($key = null) |
|
65 | 65 | { |
66 | 66 | if (!empty($key)) { |
67 | 67 | $path = $this->getFullKeyPath($key); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | } else { |
73 | 73 | // clean the directory: |
74 | - $this->deleteDirectory(MODX_PATH . $this->directory); |
|
74 | + $this->deleteDirectory(MODX_PATH.$this->directory); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | */ |
82 | 82 | protected function getFullKeyPath($key) |
83 | 83 | { |
84 | - return rtrim($this->directory, '/') . DIRECTORY_SEPARATOR . |
|
85 | - preg_replace('/[^A-Za-z0-9\_\-]/', '', str_replace(['/', ' '], '_', $key)) . |
|
84 | + return rtrim($this->directory, '/').DIRECTORY_SEPARATOR. |
|
85 | + preg_replace('/[^A-Za-z0-9\_\-]/', '', str_replace(['/', ' '], '_', $key)). |
|
86 | 86 | '.php'; |
87 | 87 | } |
88 | 88 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param bool $default |
59 | 59 | * @return bool |
60 | 60 | */ |
61 | - public function promptConfirm(string $question, $default=true) |
|
61 | + public function promptConfirm(string $question, $default = true) |
|
62 | 62 | { |
63 | 63 | $confirmationQuestion = new ConfirmationQuestion($question.' <comment>(Y/N)</comment> ', $default); |
64 | 64 | return $this->questionHelper->ask($this->input, $this->output, $confirmationQuestion); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param string|mixed $default |
70 | 70 | * @return string|mixed ~ user input |
71 | 71 | */ |
72 | - public function promptInput(string $question, $default=null) |
|
72 | + public function promptInput(string $question, $default = null) |
|
73 | 73 | { |
74 | 74 | $questionInput = new Question($question, $default); |
75 | 75 | return $this->questionHelper->ask($this->input, $this->output, $questionInput); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param string $error_message ~ ex: 'Color %s is invalid.' |
83 | 83 | * @return mixed ~ selected value |
84 | 84 | */ |
85 | - public function promptSelectOneOption(string $question, $default=null, $options=[], $error_message='%s is an invalid choice.') |
|
85 | + public function promptSelectOneOption(string $question, $default = null, $options = [], $error_message = '%s is an invalid choice.') |
|
86 | 86 | { |
87 | 87 | $pretty_options = $this->getPrettyOptions($options); |
88 | 88 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param string $error_message ~ ex: 'Color %s is invalid.' |
105 | 105 | * @return array ~ array of selected values |
106 | 106 | */ |
107 | - public function promptSelectMultipleOptions(string $question, $default=null, $options=[], $error_message='%s is an invalid choice.') |
|
107 | + public function promptSelectMultipleOptions(string $question, $default = null, $options = [], $error_message = '%s is an invalid choice.') |
|
108 | 108 | { |
109 | 109 | $pretty_options = $this->getPrettyOptions($options); |
110 | 110 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string|mixed $default |
127 | 127 | * @return string|mixed ~ user input |
128 | 128 | */ |
129 | - public function promptHiddenInput(string $question, $default=null) |
|
129 | + public function promptHiddenInput(string $question, $default = null) |
|
130 | 130 | { |
131 | 131 | $questionInput = new Question($question, $default); |
132 | 132 | $questionInput |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | // https://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential#173479 |
166 | 166 | if (array_keys($options) !== range(0, count($options) - 1)) { |
167 | 167 | foreach ($options as $option => $value) { |
168 | - $pretty_options['choices'][] = $option . '(' . $value . ')'; |
|
169 | - $pretty_options['choices'][$option . '(' . $value . ')'] = $value; |
|
168 | + $pretty_options['choices'][] = $option.'('.$value.')'; |
|
169 | + $pretty_options['choices'][$option.'('.$value.')'] = $value; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | } else { |
@@ -21,22 +21,22 @@ discard block |
||
21 | 21 | * @param string $config_path |
22 | 22 | * @param array $config |
23 | 23 | */ |
24 | - public function __construct($config_path, array $config=[]) |
|
24 | + public function __construct($config_path, array $config = []) |
|
25 | 25 | { |
26 | 26 | |
27 | - $this->config_path = $config_path . 'core/config/' . (defined('MODX_CONFIG_KEY') ? MODX_CONFIG_PATH : 'config'). '.inc.php'; |
|
27 | + $this->config_path = $config_path.'core/config/'.(defined('MODX_CONFIG_KEY') ? MODX_CONFIG_PATH : 'config').'.inc.php'; |
|
28 | 28 | |
29 | 29 | $defaults = [ |
30 | - 'site_sessionname' => 'SN' . uniqid(''), |
|
31 | - 'core_path' => (defined('MODX_CORE_PATH') ? MODX_CORE_PATH : MODX_PATH . 'core/'), |
|
32 | - 'mgr_path' => (defined('MODX_MANAGER_PATH') ? MODX_MANAGER_PATH : MODX_PATH . 'manager/'), |
|
30 | + 'site_sessionname' => 'SN'.uniqid(''), |
|
31 | + 'core_path' => (defined('MODX_CORE_PATH') ? MODX_CORE_PATH : MODX_PATH.'core/'), |
|
32 | + 'mgr_path' => (defined('MODX_MANAGER_PATH') ? MODX_MANAGER_PATH : MODX_PATH.'manager/'), |
|
33 | 33 | 'mgr_url' => (defined('MODX_MANAGER_URL') ? MODX_MANAGER_URL : '/manager/'), |
34 | - 'connectors_path' => (defined('MODX_CONNECTORS_PATH') ? MODX_CONNECTORS_PATH : MODX_PATH . 'connectors/'), |
|
34 | + 'connectors_path' => (defined('MODX_CONNECTORS_PATH') ? MODX_CONNECTORS_PATH : MODX_PATH.'connectors/'), |
|
35 | 35 | 'connectors_url' => (defined('MODX_CONNECTORS_URL') ? MODX_CONNECTORS_URL : '/connectors/'), |
36 | 36 | 'web_path' => (defined('MODX_BASE_PATH') ? MODX_BASE_PATH : MODX_PATH), |
37 | 37 | 'web_url' => (defined('MODX_BASE_URL') ? MODX_BASE_URL : '/'), |
38 | - 'processors_path' => (defined('MODX_CORE_PATH') ? MODX_CORE_PATH : MODX_PATH . 'core/') . 'model/modx/processors/', |
|
39 | - 'assets_path' => (defined('MODX_ASSETS_PATH') ? MODX_ASSETS_PATH : MODX_PATH . 'assets/'), |
|
38 | + 'processors_path' => (defined('MODX_CORE_PATH') ? MODX_CORE_PATH : MODX_PATH.'core/').'model/modx/processors/', |
|
39 | + 'assets_path' => (defined('MODX_ASSETS_PATH') ? MODX_ASSETS_PATH : MODX_PATH.'assets/'), |
|
40 | 40 | 'assets_url' => (defined('MODX_ASSETS_URL') ? MODX_ASSETS_URL : '/assets/'), |
41 | 41 | |
42 | 42 | 'database_dsn' => '', |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $this->config['database_password'] = addslashes($this->config['database_password']); |
103 | 103 | |
104 | 104 | $this->config['last_install_time'] = time(); |
105 | - $this->config['site_id'] = uniqid('modx',true); |
|
105 | + $this->config['site_id'] = uniqid('modx', true); |
|
106 | 106 | |
107 | 107 | /* make UUID if not set */ |
108 | 108 | if (empty($this->config['uuid'])) { |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | $replace = []; |
119 | 119 | foreach ($this->config as $key => $value) { |
120 | 120 | if (is_scalar($value)) { |
121 | - $replace['{' . $key . '}'] = $value; |
|
121 | + $replace['{'.$key.'}'] = $value; |
|
122 | 122 | } elseif (is_array($value)) { |
123 | - $replace['{' . $key . '}'] = var_export($value, true); |
|
123 | + $replace['{'.$key.'}'] = var_export($value, true); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function generateUUID() { |
170 | 170 | srand(intval(microtime(true) * 1000)); |
171 | - $b = md5(uniqid(rand(),true),true); |
|
171 | + $b = md5(uniqid(rand(), true), true); |
|
172 | 172 | $b[6] = chr((ord($b[6]) & 0x0F) | 0x40); |
173 | 173 | $b[8] = chr((ord($b[8]) & 0x3F) | 0x80); |
174 | - return implode('-',unpack('H8a/H4b/H4c/H4d/H12e',$b)); |
|
174 | + return implode('-', unpack('H8a/H4b/H4c/H4d/H12e', $b)); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | \ No newline at end of file |