@@ -369,7 +369,7 @@ |
||
369 | 369 | /** |
370 | 370 | * Returns list of config settings. |
371 | 371 | * |
372 | - * @return AbstractConfigSetting[] |
|
372 | + * @return PathsConfigSetting[] |
|
373 | 373 | */ |
374 | 374 | public function getConfigSettings() |
375 | 375 | { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | $ret = parent::completeArgumentValues($argumentName, $context); |
99 | 99 | |
100 | - if ( $argumentName == 'sub-command' ) { |
|
100 | + if ($argumentName == 'sub-command') { |
|
101 | 101 | return $this->getSubCommands(); |
102 | 102 | } |
103 | 103 | |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | { |
114 | 114 | $ret = array(); |
115 | 115 | |
116 | - foreach ( $this->getApplication()->all() as $command ) { |
|
117 | - if ( $command instanceof IAggregatorAwareCommand ) { |
|
116 | + foreach ($this->getApplication()->all() as $command) { |
|
117 | + if ($command instanceof IAggregatorAwareCommand) { |
|
118 | 118 | $ret[] = $command->getName(); |
119 | 119 | } |
120 | 120 | } |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | { |
130 | 130 | $sub_command = $this->io->getArgument('sub-command'); |
131 | 131 | |
132 | - if ( !in_array($sub_command, $this->getSubCommands()) ) { |
|
132 | + if (!in_array($sub_command, $this->getSubCommands())) { |
|
133 | 133 | throw new \RuntimeException( |
134 | 134 | 'The "' . $sub_command . '" sub-command is unknown or doesn\'t support aggregation.' |
135 | 135 | ); |
136 | 136 | } |
137 | 137 | |
138 | - if ( $this->processIgnoreAdd() || $this->processIgnoreRemove() || $this->processIgnoreShow() ) { |
|
138 | + if ($this->processIgnoreAdd() || $this->processIgnoreRemove() || $this->processIgnoreShow()) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | |
@@ -153,18 +153,18 @@ discard block |
||
153 | 153 | { |
154 | 154 | $raw_ignore_add = $this->io->getOption('ignore-add'); |
155 | 155 | |
156 | - if ( $raw_ignore_add === null ) { |
|
156 | + if ($raw_ignore_add === null) { |
|
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | |
160 | 160 | $ignored = $this->getIgnored(); |
161 | 161 | $ignore_add = realpath($this->getPath() . '/' . $raw_ignore_add); |
162 | 162 | |
163 | - if ( $ignore_add === false ) { |
|
163 | + if ($ignore_add === false) { |
|
164 | 164 | throw new CommandException('The "' . $raw_ignore_add . '" path does not exist.'); |
165 | 165 | } |
166 | 166 | |
167 | - if ( in_array($ignore_add, $ignored) ) { |
|
167 | + if (in_array($ignore_add, $ignored)) { |
|
168 | 168 | throw new CommandException('The "' . $ignore_add . '" directory is already ignored.'); |
169 | 169 | } |
170 | 170 | |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | { |
185 | 185 | $raw_ignore_remove = $this->io->getOption('ignore-remove'); |
186 | 186 | |
187 | - if ( $raw_ignore_remove === null ) { |
|
187 | + if ($raw_ignore_remove === null) { |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
191 | 191 | $ignored = $this->getIgnored(); |
192 | 192 | $ignore_remove = realpath($this->getPath() . '/' . $raw_ignore_remove); |
193 | 193 | |
194 | - if ( $ignore_remove === false ) { |
|
194 | + if ($ignore_remove === false) { |
|
195 | 195 | throw new CommandException('The "' . $raw_ignore_remove . '" path does not exist.'); |
196 | 196 | } |
197 | 197 | |
198 | - if ( !in_array($ignore_remove, $ignored) ) { |
|
198 | + if (!in_array($ignore_remove, $ignored)) { |
|
199 | 199 | throw new CommandException('The "' . $ignore_remove . '" directory is not ignored.'); |
200 | 200 | } |
201 | 201 | |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | */ |
213 | 213 | protected function processIgnoreShow() |
214 | 214 | { |
215 | - if ( !$this->io->getOption('ignore-show') ) { |
|
215 | + if (!$this->io->getOption('ignore-show')) { |
|
216 | 216 | return false; |
217 | 217 | } |
218 | 218 | |
219 | 219 | $ignored = $this->getIgnored(); |
220 | 220 | |
221 | - if ( !$ignored ) { |
|
221 | + if (!$ignored) { |
|
222 | 222 | $this->io->writeln('No paths found in ignored directory list.'); |
223 | 223 | |
224 | 224 | return true; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | $this->io->writeln(array('Paths in ignored directory list:', '')); |
228 | 228 | |
229 | - foreach ( $ignored as $ignored_path ) { |
|
229 | + foreach ($ignored as $ignored_path) { |
|
230 | 230 | $this->io->writeln(' * ' . $ignored_path); |
231 | 231 | } |
232 | 232 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | { |
258 | 258 | $path = $this->getPath(); |
259 | 259 | |
260 | - if ( $this->repositoryConnector->isWorkingCopy($path) ) { |
|
260 | + if ($this->repositoryConnector->isWorkingCopy($path)) { |
|
261 | 261 | throw new \RuntimeException('The "' . $path . '" must not be a working copy.'); |
262 | 262 | } |
263 | 263 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $with_details = $this->io->getOption('details'); |
271 | 271 | $with_summary = $this->io->getOption('summary'); |
272 | 272 | |
273 | - foreach ( $working_copies as $index => $wc_path ) { |
|
273 | + foreach ($working_copies as $index => $wc_path) { |
|
274 | 274 | $this->io->writeln(array( |
275 | 275 | '', |
276 | 276 | 'Executing <info>' . $sub_command . '</info> command on <info>' . $wc_path . '</info> path', |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | 'path' => $wc_path, |
282 | 282 | ); |
283 | 283 | |
284 | - if ( $with_details && in_array($sub_command, array('log', 'merge')) ) { |
|
284 | + if ($with_details && in_array($sub_command, array('log', 'merge'))) { |
|
285 | 285 | $sub_command_arguments['--details'] = $with_details; |
286 | 286 | } |
287 | 287 | |
288 | - if ( $with_summary && in_array($sub_command, array('log', 'merge')) ) { |
|
288 | + if ($with_summary && in_array($sub_command, array('log', 'merge'))) { |
|
289 | 289 | $sub_command_arguments['--summary'] = $with_summary; |
290 | 290 | } |
291 | 291 | |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | $all_working_copies_count = count($all_working_copies); |
316 | 316 | $working_copies_count = count($working_copies); |
317 | 317 | |
318 | - if ( $all_working_copies_count != $working_copies_count ) { |
|
318 | + if ($all_working_copies_count != $working_copies_count) { |
|
319 | 319 | $ignored_suffix = ' (' . ($all_working_copies_count - $working_copies_count) . ' ignored)'; |
320 | 320 | } |
321 | 321 | else { |
322 | 322 | $ignored_suffix = ''; |
323 | 323 | } |
324 | 324 | |
325 | - if ( !$working_copies ) { |
|
325 | + if (!$working_copies) { |
|
326 | 326 | $this->io->writeln('<error>None found' . $ignored_suffix . '</error>'); |
327 | 327 | |
328 | 328 | throw new CommandException('No working copies found at "' . $path . '" path.'); |
@@ -344,18 +344,18 @@ discard block |
||
344 | 344 | { |
345 | 345 | $working_copies = array(); |
346 | 346 | |
347 | - if ( $this->io->isVerbose() ) { |
|
347 | + if ($this->io->isVerbose()) { |
|
348 | 348 | $this->io->writeln( |
349 | 349 | PHP_EOL . '<fg=white;bg=magenta>scanning: ' . $path . '</>' |
350 | 350 | ); |
351 | 351 | } |
352 | 352 | |
353 | - foreach ( glob($path . '/*', GLOB_ONLYDIR) as $sub_folder ) { |
|
354 | - if ( file_exists($sub_folder . '/.git') || file_exists($sub_folder . '/CVS') ) { |
|
353 | + foreach (glob($path . '/*', GLOB_ONLYDIR) as $sub_folder) { |
|
354 | + if (file_exists($sub_folder . '/.git') || file_exists($sub_folder . '/CVS')) { |
|
355 | 355 | continue; |
356 | 356 | } |
357 | 357 | |
358 | - if ( $this->repositoryConnector->isWorkingCopy($sub_folder) ) { |
|
358 | + if ($this->repositoryConnector->isWorkingCopy($sub_folder)) { |
|
359 | 359 | $working_copies[] = $sub_folder; |
360 | 360 | } |
361 | 361 | else { |
@@ -317,8 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | if ( $all_working_copies_count != $working_copies_count ) { |
319 | 319 | $ignored_suffix = ' (' . ($all_working_copies_count - $working_copies_count) . ' ignored)'; |
320 | - } |
|
321 | - else { |
|
320 | + } else { |
|
322 | 321 | $ignored_suffix = ''; |
323 | 322 | } |
324 | 323 | |
@@ -357,8 +356,7 @@ discard block |
||
357 | 356 | |
358 | 357 | if ( $this->repositoryConnector->isWorkingCopy($sub_folder) ) { |
359 | 358 | $working_copies[] = $sub_folder; |
360 | - } |
|
361 | - else { |
|
359 | + } else { |
|
362 | 360 | $working_copies = array_merge($working_copies, $this->getWorkingCopiesRecursive($sub_folder)); |
363 | 361 | } |
364 | 362 | } |
@@ -203,7 +203,7 @@ |
||
203 | 203 | * |
204 | 204 | * @param mixed $value Value. |
205 | 205 | * |
206 | - * @return mixed |
|
206 | + * @return string |
|
207 | 207 | */ |
208 | 208 | protected function openEditor($value) |
209 | 209 | { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | { |
122 | 122 | $ret = parent::completeOptionValues($optionName, $context); |
123 | 123 | |
124 | - if ( in_array($optionName, array('show', 'edit', 'delete')) ) { |
|
124 | + if (in_array($optionName, array('show', 'edit', 'delete'))) { |
|
125 | 125 | return array_keys($this->configSettings); |
126 | 126 | } |
127 | 127 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function execute(InputInterface $input, OutputInterface $output) |
135 | 135 | { |
136 | - if ( $this->processShow() || $this->processEdit() || $this->processDelete() ) { |
|
136 | + if ($this->processShow() || $this->processEdit() || $this->processDelete()) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | { |
150 | 150 | $setting_name = $this->io->getOption('show'); |
151 | 151 | |
152 | - if ( $setting_name === null ) { |
|
152 | + if ($setting_name === null) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | { |
168 | 168 | $setting_name = $this->io->getOption('edit'); |
169 | 169 | |
170 | - if ( $setting_name === null ) { |
|
170 | + if ($setting_name === null) { |
|
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $value = $config_setting->getValue($this->getValueFilter()); |
176 | 176 | $retry = false; |
177 | 177 | |
178 | - if ( $config_setting instanceof ArrayConfigSetting ) { |
|
178 | + if ($config_setting instanceof ArrayConfigSetting) { |
|
179 | 179 | $value = implode(PHP_EOL, $value); |
180 | 180 | } |
181 | 181 | |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | $config_setting->setValue($value, $this->getScopeFilter()); |
187 | 187 | $this->io->writeln('Setting <info>' . $setting_name . '</info> was edited.'); |
188 | 188 | } |
189 | - catch ( \InvalidArgumentException $e ) { |
|
189 | + catch (\InvalidArgumentException $e) { |
|
190 | 190 | $this->io->writeln(array('<error>' . $e->getMessage() . '</error>', '')); |
191 | 191 | |
192 | - if ( $this->io->askConfirmation('Retry editing', false) ) { |
|
192 | + if ($this->io->askConfirmation('Retry editing', false)) { |
|
193 | 193 | $retry = true; |
194 | 194 | } |
195 | 195 | } |
196 | - } while ( $retry ); |
|
196 | + } while ($retry); |
|
197 | 197 | |
198 | 198 | return true; |
199 | 199 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | { |
223 | 223 | $setting_name = $this->io->getOption('delete'); |
224 | 224 | |
225 | - if ( $setting_name === null ) { |
|
225 | + if ($setting_name === null) { |
|
226 | 226 | return false; |
227 | 227 | } |
228 | 228 | |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | */ |
243 | 243 | protected function listSettings($setting_name = null) |
244 | 244 | { |
245 | - if ( isset($setting_name) ) { |
|
245 | + if (isset($setting_name)) { |
|
246 | 246 | $this->getConfigSetting($setting_name); |
247 | 247 | } |
248 | 248 | |
249 | 249 | $extra_title = isset($setting_name) ? ' (filtered)' : ''; |
250 | 250 | |
251 | - if ( $this->isGlobal() ) { |
|
251 | + if ($this->isGlobal()) { |
|
252 | 252 | $this->io->writeln('Showing global settings' . $extra_title . ':'); |
253 | 253 | } |
254 | 254 | else { |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | |
267 | 267 | $value_filter = $this->getValueFilter(); |
268 | 268 | |
269 | - foreach ( $this->getConfigSettingsByScope($this->getScopeFilter()) as $name => $config_setting ) { |
|
270 | - if ( isset($setting_name) && $name !== $setting_name ) { |
|
269 | + foreach ($this->getConfigSettingsByScope($this->getScopeFilter()) as $name => $config_setting) { |
|
270 | + if (isset($setting_name) && $name !== $setting_name) { |
|
271 | 271 | continue; |
272 | 272 | } |
273 | 273 | |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | { |
292 | 292 | $ret = array(); |
293 | 293 | |
294 | - foreach ( $this->configSettings as $name => $config_setting ) { |
|
295 | - if ( $config_setting->isWithinScope($scope_filter) ) { |
|
294 | + foreach ($this->configSettings as $name => $config_setting) { |
|
295 | + if ($config_setting->isWithinScope($scope_filter)) { |
|
296 | 296 | $ret[$name] = $config_setting; |
297 | 297 | } |
298 | 298 | } |
@@ -310,13 +310,13 @@ discard block |
||
310 | 310 | */ |
311 | 311 | protected function getConfigSetting($name) |
312 | 312 | { |
313 | - if ( !array_key_exists($name, $this->configSettings) ) { |
|
313 | + if (!array_key_exists($name, $this->configSettings)) { |
|
314 | 314 | throw new \InvalidArgumentException('The "' . $name . '" setting is unknown.'); |
315 | 315 | } |
316 | 316 | |
317 | 317 | $config_setting = $this->configSettings[$name]; |
318 | 318 | |
319 | - if ( !$config_setting->isWithinScope($this->getScopeFilter()) ) { |
|
319 | + if (!$config_setting->isWithinScope($this->getScopeFilter())) { |
|
320 | 320 | throw new \InvalidArgumentException('The "' . $name . '" setting cannot be used in this scope.'); |
321 | 321 | } |
322 | 322 | |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | /** @var AbstractConfigSetting[] $config_settings */ |
354 | 354 | $config_settings = array(); |
355 | 355 | |
356 | - foreach ( $this->getApplication()->all() as $command ) { |
|
357 | - if ( $command instanceof IConfigAwareCommand ) { |
|
358 | - foreach ( $command->getConfigSettings() as $config_setting ) { |
|
356 | + foreach ($this->getApplication()->all() as $command) { |
|
357 | + if ($command instanceof IConfigAwareCommand) { |
|
358 | + foreach ($command->getConfigSettings() as $config_setting) { |
|
359 | 359 | $config_settings[$config_setting->getName()] = $config_setting; |
360 | 360 | } |
361 | 361 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | // Allow to operate on global settings outside of working copy. |
365 | 365 | $wc_url = $this->isGlobal() ? '' : $this->getWorkingCopyUrl(); |
366 | 366 | |
367 | - foreach ( $config_settings as $config_setting ) { |
|
367 | + foreach ($config_settings as $config_setting) { |
|
368 | 368 | $config_setting->setWorkingCopyUrl($wc_url); |
369 | 369 | $config_setting->setEditor($this->_configEditor); |
370 | 370 | } |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | protected function isGlobal() |
381 | 381 | { |
382 | 382 | // During auto-complete the IO isn't set. |
383 | - if ( !isset($this->io) ) { |
|
383 | + if (!isset($this->io)) { |
|
384 | 384 | return true; |
385 | 385 | } |
386 | 386 |
@@ -185,8 +185,7 @@ discard block |
||
185 | 185 | $value = $this->openEditor($value); |
186 | 186 | $config_setting->setValue($value, $this->getScopeFilter()); |
187 | 187 | $this->io->writeln('Setting <info>' . $setting_name . '</info> was edited.'); |
188 | - } |
|
189 | - catch ( \InvalidArgumentException $e ) { |
|
188 | + } catch ( \InvalidArgumentException $e ) { |
|
190 | 189 | $this->io->writeln(array('<error>' . $e->getMessage() . '</error>', '')); |
191 | 190 | |
192 | 191 | if ( $this->io->askConfirmation('Retry editing', false) ) { |
@@ -250,8 +249,7 @@ discard block |
||
250 | 249 | |
251 | 250 | if ( $this->isGlobal() ) { |
252 | 251 | $this->io->writeln('Showing global settings' . $extra_title . ':'); |
253 | - } |
|
254 | - else { |
|
252 | + } else { |
|
255 | 253 | $this->io->writeln( |
256 | 254 | 'Showing settings' . $extra_title . ' for <info>' . $this->getWorkingCopyPath() . '</info> path:' |
257 | 255 | ); |
@@ -549,7 +549,7 @@ |
||
549 | 549 | /** |
550 | 550 | * Returns list of config settings. |
551 | 551 | * |
552 | - * @return AbstractConfigSetting[] |
|
552 | + * @return StringConfigSetting[] |
|
553 | 553 | */ |
554 | 554 | public function getConfigSettings() |
555 | 555 | { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | $ret = parent::completeOptionValues($optionName, $context); |
145 | 145 | |
146 | - if ( $optionName === 'revisions' ) { |
|
146 | + if ($optionName === 'revisions') { |
|
147 | 147 | return array('all'); |
148 | 148 | } |
149 | 149 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $bugs = $this->getList($this->io->getOption('bugs')); |
159 | 159 | $revisions = $this->getList($this->io->getOption('revisions')); |
160 | 160 | |
161 | - if ( $bugs && $revisions ) { |
|
161 | + if ($bugs && $revisions) { |
|
162 | 162 | throw new \RuntimeException('The "--bugs" and "--revisions" options are mutually exclusive.'); |
163 | 163 | } |
164 | 164 | |
@@ -170,36 +170,36 @@ discard block |
||
170 | 170 | $this->printSourceAndTarget($source_url, $wc_path); |
171 | 171 | $this->_unmergedRevisions = $this->getUnmergedRevisions($source_url, $wc_path); |
172 | 172 | |
173 | - if ( ($bugs || $revisions) && !$this->_unmergedRevisions ) { |
|
173 | + if (($bugs || $revisions) && !$this->_unmergedRevisions) { |
|
174 | 174 | throw new CommandException('Nothing to merge.'); |
175 | 175 | } |
176 | 176 | |
177 | 177 | $this->ensureWorkingCopyWithoutConflicts($source_url, $wc_path); |
178 | 178 | |
179 | - if ( $this->shouldMergeAll($revisions) ) { |
|
179 | + if ($this->shouldMergeAll($revisions)) { |
|
180 | 180 | $revisions = $this->_unmergedRevisions; |
181 | 181 | } |
182 | 182 | else { |
183 | - if ( $revisions ) { |
|
183 | + if ($revisions) { |
|
184 | 184 | $revisions = $this->getDirectRevisions($revisions, $source_url); |
185 | 185 | } |
186 | - elseif ( $bugs ) { |
|
186 | + elseif ($bugs) { |
|
187 | 187 | $revisions = $this->getRevisionLog($source_url)->find('bugs', $bugs); |
188 | 188 | } |
189 | 189 | |
190 | - if ( $revisions ) { |
|
190 | + if ($revisions) { |
|
191 | 191 | $revisions = array_intersect($revisions, $this->_unmergedRevisions); |
192 | 192 | |
193 | - if ( !$revisions ) { |
|
193 | + if (!$revisions) { |
|
194 | 194 | throw new CommandException('Requested revisions are already merged'); |
195 | 195 | } |
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | - if ( $revisions ) { |
|
199 | + if ($revisions) { |
|
200 | 200 | $this->performMerge($source_url, $wc_path, $revisions); |
201 | 201 | } |
202 | - elseif ( $this->_unmergedRevisions ) { |
|
202 | + elseif ($this->_unmergedRevisions) { |
|
203 | 203 | $this->runOtherCommand('log', array( |
204 | 204 | 'path' => $this->repositoryConnector->getProjectUrl($source_url), |
205 | 205 | '--revisions' => implode(',', $this->_unmergedRevisions), |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | { |
235 | 235 | $this->io->write(' * Working Copy Status ... '); |
236 | 236 | |
237 | - if ( $this->repositoryConnector->isMixedRevisionWorkingCopy($wc_path) ) { |
|
237 | + if ($this->repositoryConnector->isMixedRevisionWorkingCopy($wc_path)) { |
|
238 | 238 | $this->io->writeln('<error>Mixed revisions</error>'); |
239 | 239 | $this->updateWorkingCopy($wc_path); |
240 | 240 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $this->repositoryConnector->getWorkingCopyUrl($wc_path) |
247 | 247 | ); |
248 | 248 | |
249 | - if ( $repository_revision > $working_copy_revision ) { |
|
249 | + if ($repository_revision > $working_copy_revision) { |
|
250 | 250 | $this->io->writeln('<error>Out of date</error>'); |
251 | 251 | $this->updateWorkingCopy($wc_path); |
252 | 252 | |
@@ -281,20 +281,20 @@ discard block |
||
281 | 281 | { |
282 | 282 | $source_url = $this->io->getOption('source-url'); |
283 | 283 | |
284 | - if ( $source_url === null ) { |
|
284 | + if ($source_url === null) { |
|
285 | 285 | $source_url = $this->getSetting(self::SETTING_MERGE_SOURCE_URL); |
286 | 286 | } |
287 | 287 | |
288 | - if ( !$source_url ) { |
|
288 | + if (!$source_url) { |
|
289 | 289 | $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path); |
290 | 290 | $source_url = $this->_mergeSourceDetector->detect($wc_url); |
291 | 291 | |
292 | - if ( $source_url ) { |
|
292 | + if ($source_url) { |
|
293 | 293 | $this->setSetting(self::SETTING_MERGE_SOURCE_URL, $source_url); |
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
297 | - if ( !$source_url ) { |
|
297 | + if (!$source_url) { |
|
298 | 298 | $error_msg = 'Unable to determine source url for merge.' . PHP_EOL; |
299 | 299 | $error_msg .= 'Please specify it manually using "--source-url" option'; |
300 | 300 | throw new CommandException($error_msg); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $this->io->write(' * Upcoming Merge Status ... '); |
339 | 339 | $unmerged_revisions = $this->calculateUnmergedRevisions($source_url, $wc_path); |
340 | 340 | |
341 | - if ( $unmerged_revisions ) { |
|
341 | + if ($unmerged_revisions) { |
|
342 | 342 | $unmerged_bugs = $revision_log->getBugsFromRevisions($unmerged_revisions); |
343 | 343 | $error_msg = '<error>%d revision(-s) or %d bug(-s) not merged</error>'; |
344 | 344 | $this->io->writeln(sprintf($error_msg, count($unmerged_revisions), count($unmerged_bugs))); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $merge_info = $command->run(); |
377 | 377 | $merge_info = explode(PHP_EOL, $merge_info); |
378 | 378 | |
379 | - foreach ( $merge_info as $index => $revision ) { |
|
379 | + foreach ($merge_info as $index => $revision) { |
|
380 | 380 | $merge_info[$index] = ltrim($revision, 'r'); |
381 | 381 | } |
382 | 382 | |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | $merge_info = $this->repositoryConnector->getProperty('svn:mergeinfo', $wc_path); |
397 | 397 | $merge_info = array_filter(explode("\n", $merge_info)); |
398 | 398 | |
399 | - foreach ( $merge_info as $merge_info_line ) { |
|
399 | + foreach ($merge_info as $merge_info_line) { |
|
400 | 400 | list($path, $revisions) = explode(':', $merge_info_line, 2); |
401 | 401 | |
402 | - if ( $path == $source_path ) { |
|
402 | + if ($path == $source_path) { |
|
403 | 403 | return $this->_revisionListParser->expandRanges(explode(',', $revisions)); |
404 | 404 | } |
405 | 405 | } |
@@ -423,11 +423,11 @@ discard block |
||
423 | 423 | try { |
424 | 424 | $revisions = $this->_revisionListParser->expandRanges($revisions); |
425 | 425 | |
426 | - foreach ( $revisions as $revision ) { |
|
426 | + foreach ($revisions as $revision) { |
|
427 | 427 | $revision_log->getRevisionData('summary', $revision); |
428 | 428 | } |
429 | 429 | } |
430 | - catch ( \InvalidArgumentException $e ) { |
|
430 | + catch (\InvalidArgumentException $e) { |
|
431 | 431 | throw new CommandException($e->getMessage()); |
432 | 432 | } |
433 | 433 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | { |
448 | 448 | sort($revisions, SORT_NUMERIC); |
449 | 449 | |
450 | - foreach ( $revisions as $revision ) { |
|
450 | + foreach ($revisions as $revision) { |
|
451 | 451 | $command = $this->repositoryConnector->getCommand( |
452 | 452 | 'merge', |
453 | 453 | '-c ' . $revision . ' {' . $source_url . '} {' . $wc_path . '}' |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | |
481 | 481 | $conflicts = $this->repositoryConnector->getWorkingCopyConflicts($wc_path); |
482 | 482 | |
483 | - if ( !$conflicts ) { |
|
483 | + if (!$conflicts) { |
|
484 | 484 | $this->io->writeln('<info>Successful</info>'); |
485 | 485 | |
486 | 486 | return; |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | |
491 | 491 | $table = new Table($this->io->getOutput()); |
492 | 492 | |
493 | - if ( $largest_suggested_revision ) { |
|
493 | + if ($largest_suggested_revision) { |
|
494 | 494 | $table->setHeaders(array( |
495 | 495 | 'Path', |
496 | 496 | 'Associated Revisions (before ' . $largest_suggested_revision . ')', |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | $revision_log = $this->getRevisionLog($source_url); |
507 | 507 | $source_path = $this->repositoryConnector->getPathFromUrl($source_url) . '/'; |
508 | 508 | |
509 | - foreach ( $conflicts as $conflict_path ) { |
|
509 | + foreach ($conflicts as $conflict_path) { |
|
510 | 510 | $path_revisions = $revision_log->find('paths', $source_path . $conflict_path); |
511 | 511 | $path_revisions = array_intersect($this->_unmergedRevisions, $path_revisions); |
512 | 512 | |
513 | - if ( $path_revisions && isset($largest_suggested_revision) ) { |
|
513 | + if ($path_revisions && isset($largest_suggested_revision)) { |
|
514 | 514 | $path_revisions = $this->limitRevisions($path_revisions, $largest_suggested_revision); |
515 | 515 | } |
516 | 516 | |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | { |
538 | 538 | $ret = array(); |
539 | 539 | |
540 | - foreach ( $revisions as $revision ) { |
|
541 | - if ( $revision < $max_revision ) { |
|
540 | + foreach ($revisions as $revision) { |
|
541 | + if ($revision < $max_revision) { |
|
542 | 542 | $ret[] = $revision; |
543 | 543 | } |
544 | 544 | } |
@@ -178,12 +178,10 @@ discard block |
||
178 | 178 | |
179 | 179 | if ( $this->shouldMergeAll($revisions) ) { |
180 | 180 | $revisions = $this->_unmergedRevisions; |
181 | - } |
|
182 | - else { |
|
181 | + } else { |
|
183 | 182 | if ( $revisions ) { |
184 | 183 | $revisions = $this->getDirectRevisions($revisions, $source_url); |
185 | - } |
|
186 | - elseif ( $bugs ) { |
|
184 | + } elseif ( $bugs ) { |
|
187 | 185 | $revisions = $this->getRevisionLog($source_url)->find('bugs', $bugs); |
188 | 186 | } |
189 | 187 | |
@@ -198,8 +196,7 @@ discard block |
||
198 | 196 | |
199 | 197 | if ( $revisions ) { |
200 | 198 | $this->performMerge($source_url, $wc_path, $revisions); |
201 | - } |
|
202 | - elseif ( $this->_unmergedRevisions ) { |
|
199 | + } elseif ( $this->_unmergedRevisions ) { |
|
203 | 200 | $this->runOtherCommand('log', array( |
204 | 201 | 'path' => $this->repositoryConnector->getProjectUrl($source_url), |
205 | 202 | '--revisions' => implode(',', $this->_unmergedRevisions), |
@@ -342,8 +339,7 @@ discard block |
||
342 | 339 | $unmerged_bugs = $revision_log->getBugsFromRevisions($unmerged_revisions); |
343 | 340 | $error_msg = '<error>%d revision(-s) or %d bug(-s) not merged</error>'; |
344 | 341 | $this->io->writeln(sprintf($error_msg, count($unmerged_revisions), count($unmerged_bugs))); |
345 | - } |
|
346 | - else { |
|
342 | + } else { |
|
347 | 343 | $this->io->writeln('<info>Up to date</info>'); |
348 | 344 | } |
349 | 345 | |
@@ -426,8 +422,7 @@ discard block |
||
426 | 422 | foreach ( $revisions as $revision ) { |
427 | 423 | $revision_log->getRevisionData('summary', $revision); |
428 | 424 | } |
429 | - } |
|
430 | - catch ( \InvalidArgumentException $e ) { |
|
425 | + } catch ( \InvalidArgumentException $e ) { |
|
431 | 426 | throw new CommandException($e->getMessage()); |
432 | 427 | } |
433 | 428 | |
@@ -495,8 +490,7 @@ discard block |
||
495 | 490 | 'Path', |
496 | 491 | 'Associated Revisions (before ' . $largest_suggested_revision . ')', |
497 | 492 | )); |
498 | - } |
|
499 | - else { |
|
493 | + } else { |
|
500 | 494 | $table->setHeaders(array( |
501 | 495 | 'Path', |
502 | 496 | 'Associated Revisions', |
@@ -155,7 +155,7 @@ |
||
155 | 155 | /** |
156 | 156 | * Returns cache invalidator for this plugin data. |
157 | 157 | * |
158 | - * @return string |
|
158 | + * @return integer |
|
159 | 159 | */ |
160 | 160 | public function getCacheInvalidator() |
161 | 161 | { |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function parse(\SimpleXMLElement $log) |
69 | 69 | { |
70 | - foreach ( $log->logentry as $log_entry ) { |
|
70 | + foreach ($log->logentry as $log_entry) { |
|
71 | 71 | $revision = (int)$log_entry['revision']; |
72 | 72 | $this->_revisionBugs[$revision] = $this->_logMessageParser->parse((string)$log_entry->msg); |
73 | 73 | |
74 | - foreach ( $this->_revisionBugs[$revision] as $bug_id ) { |
|
75 | - if ( !isset($this->_bugRevisions[$bug_id]) ) { |
|
74 | + foreach ($this->_revisionBugs[$revision] as $bug_id) { |
|
75 | + if (!isset($this->_bugRevisions[$bug_id])) { |
|
76 | 76 | $this->_bugRevisions[$bug_id] = array(); |
77 | 77 | } |
78 | 78 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | { |
93 | 93 | $bug_revisions = array(); |
94 | 94 | |
95 | - foreach ( $criteria as $bug_id ) { |
|
96 | - if ( !array_key_exists($bug_id, $this->_bugRevisions) ) { |
|
95 | + foreach ($criteria as $bug_id) { |
|
96 | + if (!array_key_exists($bug_id, $this->_bugRevisions)) { |
|
97 | 97 | continue; |
98 | 98 | } |
99 | 99 | |
100 | - foreach ( $this->_bugRevisions[$bug_id] as $revision ) { |
|
100 | + foreach ($this->_bugRevisions[$bug_id] as $revision) { |
|
101 | 101 | $bug_revisions[$revision] = true; |
102 | 102 | } |
103 | 103 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getRevisionData($revision) |
120 | 120 | { |
121 | - if ( !isset($this->_revisionBugs[$revision]) ) { |
|
121 | + if (!isset($this->_revisionBugs[$revision])) { |
|
122 | 122 | $error_msg = 'Revision "%s" not found by "%s" plugin.'; |
123 | 123 | throw new \InvalidArgumentException(sprintf($error_msg, $revision, $this->getName())); |
124 | 124 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function getLastRevision() |
171 | 171 | { |
172 | - if ( !$this->_revisionBugs ) { |
|
172 | + if (!$this->_revisionBugs) { |
|
173 | 173 | return null; |
174 | 174 | } |
175 | 175 |
@@ -153,7 +153,7 @@ |
||
153 | 153 | /** |
154 | 154 | * Returns cache invalidator for this plugin data. |
155 | 155 | * |
156 | - * @return string |
|
156 | + * @return integer |
|
157 | 157 | */ |
158 | 158 | public function getCacheInvalidator() |
159 | 159 | { |
@@ -48,23 +48,23 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function parse(\SimpleXMLElement $log) |
50 | 50 | { |
51 | - foreach ( $log->logentry as $log_entry ) { |
|
51 | + foreach ($log->logentry as $log_entry) { |
|
52 | 52 | $revision_merges = array(); |
53 | 53 | $revision = (int)$log_entry['revision']; |
54 | 54 | |
55 | - foreach ( $log_entry->logentry as $merged_log_entry ) { |
|
55 | + foreach ($log_entry->logentry as $merged_log_entry) { |
|
56 | 56 | $merged_revision = (int)$merged_log_entry['revision']; |
57 | 57 | |
58 | 58 | $revision_merges[] = $merged_revision; |
59 | 59 | |
60 | - if ( !isset($this->_mergedRevisions[$merged_revision]) ) { |
|
60 | + if (!isset($this->_mergedRevisions[$merged_revision])) { |
|
61 | 61 | $this->_mergedRevisions[$merged_revision] = array(); |
62 | 62 | } |
63 | 63 | |
64 | 64 | $this->_mergedRevisions[$merged_revision][] = $revision; |
65 | 65 | } |
66 | 66 | |
67 | - if ( $revision_merges ) { |
|
67 | + if ($revision_merges) { |
|
68 | 68 | $this->_mergeRevisions[$revision] = $revision_merges; |
69 | 69 | } |
70 | 70 | } |
@@ -80,27 +80,27 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function find(array $criteria) |
82 | 82 | { |
83 | - if ( !$criteria ) { |
|
83 | + if (!$criteria) { |
|
84 | 84 | return array(); |
85 | 85 | } |
86 | 86 | |
87 | 87 | $first_criteria = reset($criteria); |
88 | 88 | |
89 | - if ( $first_criteria === 'all_merges' ) { |
|
89 | + if ($first_criteria === 'all_merges') { |
|
90 | 90 | return array_keys($this->_mergeRevisions); |
91 | 91 | } |
92 | - elseif ( $first_criteria === 'all_merged' ) { |
|
92 | + elseif ($first_criteria === 'all_merged') { |
|
93 | 93 | return array_keys($this->_mergedRevisions); |
94 | 94 | } |
95 | 95 | |
96 | 96 | $merged_revisions = array(); |
97 | 97 | |
98 | - foreach ( $criteria as $merge_revision ) { |
|
99 | - if ( !array_key_exists($merge_revision, $this->_mergeRevisions) ) { |
|
98 | + foreach ($criteria as $merge_revision) { |
|
99 | + if (!array_key_exists($merge_revision, $this->_mergeRevisions)) { |
|
100 | 100 | throw new \InvalidArgumentException('The merge revision ' . $merge_revision . ' not found.'); |
101 | 101 | } |
102 | 102 | |
103 | - foreach ( $this->_mergeRevisions[$merge_revision] as $merged_revision ) { |
|
103 | + foreach ($this->_mergeRevisions[$merge_revision] as $merged_revision) { |
|
104 | 104 | $merged_revisions[$merged_revision] = true; |
105 | 105 | } |
106 | 106 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function getLastRevision() |
169 | 169 | { |
170 | - if ( !$this->_mergeRevisions ) { |
|
170 | + if (!$this->_mergeRevisions) { |
|
171 | 171 | return null; |
172 | 172 | } |
173 | 173 |
@@ -88,8 +88,7 @@ |
||
88 | 88 | |
89 | 89 | if ( $first_criteria === 'all_merges' ) { |
90 | 90 | return array_keys($this->_mergeRevisions); |
91 | - } |
|
92 | - elseif ( $first_criteria === 'all_merged' ) { |
|
91 | + } elseif ( $first_criteria === 'all_merged' ) { |
|
93 | 92 | return array_keys($this->_mergedRevisions); |
94 | 93 | } |
95 | 94 |
@@ -149,7 +149,7 @@ |
||
149 | 149 | /** |
150 | 150 | * Returns cache invalidator for this plugin data. |
151 | 151 | * |
152 | - * @return string |
|
152 | + * @return integer |
|
153 | 153 | */ |
154 | 154 | public function getCacheInvalidator() |
155 | 155 | { |
@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function parse(\SimpleXMLElement $log) |
50 | 50 | { |
51 | - foreach ( $log->logentry as $log_entry ) { |
|
51 | + foreach ($log->logentry as $log_entry) { |
|
52 | 52 | $revision = (int)$log_entry['revision']; |
53 | 53 | $this->_revisionPaths[$revision] = array(); |
54 | 54 | |
55 | - foreach ( $log_entry->paths->path as $path_node ) { |
|
55 | + foreach ($log_entry->paths->path as $path_node) { |
|
56 | 56 | /** @var \SimpleXMLElement $path_node */ |
57 | 57 | $path = (string)$path_node; |
58 | 58 | |
59 | - if ( !isset($this->_pathRevisions[$path]) ) { |
|
59 | + if (!isset($this->_pathRevisions[$path])) { |
|
60 | 60 | $this->_pathRevisions[$path] = array(); |
61 | 61 | } |
62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $path_data = array('path' => $path); |
66 | 66 | |
67 | - foreach ( $path_node->attributes() as $attribute_name => $attribute_value ) { |
|
67 | + foreach ($path_node->attributes() as $attribute_name => $attribute_value) { |
|
68 | 68 | $path_data[$attribute_name] = (string)$attribute_value; |
69 | 69 | } |
70 | 70 | |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | { |
85 | 85 | $path_revisions = array(); |
86 | 86 | |
87 | - foreach ( $criteria as $path ) { |
|
87 | + foreach ($criteria as $path) { |
|
88 | 88 | $path_length = strlen($path); |
89 | 89 | |
90 | - foreach ( $this->_pathRevisions as $test_path => $revisions ) { |
|
91 | - if ( substr($test_path, 0, $path_length) == $path ) { |
|
92 | - foreach ( $revisions as $revision ) { |
|
90 | + foreach ($this->_pathRevisions as $test_path => $revisions) { |
|
91 | + if (substr($test_path, 0, $path_length) == $path) { |
|
92 | + foreach ($revisions as $revision) { |
|
93 | 93 | $path_revisions[$revision] = true; |
94 | 94 | } |
95 | 95 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getRevisionData($revision) |
114 | 114 | { |
115 | - if ( !isset($this->_revisionPaths[$revision]) ) { |
|
115 | + if (!isset($this->_revisionPaths[$revision])) { |
|
116 | 116 | $error_msg = 'Revision "%s" not found by "%s" plugin.'; |
117 | 117 | throw new \InvalidArgumentException(sprintf($error_msg, $revision, $this->getName())); |
118 | 118 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function getLastRevision() |
165 | 165 | { |
166 | - if ( !$this->_revisionPaths ) { |
|
166 | + if (!$this->_revisionPaths) { |
|
167 | 167 | return null; |
168 | 168 | } |
169 | 169 |
@@ -119,7 +119,7 @@ |
||
119 | 119 | /** |
120 | 120 | * Returns format version. |
121 | 121 | * |
122 | - * @return mixed |
|
122 | + * @return string |
|
123 | 123 | */ |
124 | 124 | private function _getCacheInvalidator() |
125 | 125 | { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function refresh() |
85 | 85 | { |
86 | - if ( !$this->_plugins ) { |
|
86 | + if (!$this->_plugins) { |
|
87 | 87 | throw new \LogicException('Please register at least one revision log plugin.'); |
88 | 88 | } |
89 | 89 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | $cache_key = 'log:' . $project_url; |
94 | 94 | $cache = $this->_cacheManager->getCache($cache_key, $this->_getCacheInvalidator()); |
95 | 95 | |
96 | - if ( is_array($cache) ) { |
|
97 | - foreach ( $this->_plugins as $plugin_name => $plugin ) { |
|
96 | + if (is_array($cache)) { |
|
97 | + foreach ($this->_plugins as $plugin_name => $plugin) { |
|
98 | 98 | $plugin->setCollectedData($cache[$plugin_name]); |
99 | 99 | } |
100 | 100 | } |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | $from_revision = $this->_getLastRevision(); |
103 | 103 | $to_revision = $this->_repositoryConnector->getLastRevision($project_url); |
104 | 104 | |
105 | - if ( $to_revision > $from_revision ) { |
|
105 | + if ($to_revision > $from_revision) { |
|
106 | 106 | $this->_queryRevisionData($from_revision, $to_revision); |
107 | 107 | |
108 | 108 | // Collect and cache plugin data. |
109 | 109 | $cache = array(); |
110 | 110 | |
111 | - foreach ( $this->_plugins as $plugin_name => $plugin ) { |
|
111 | + foreach ($this->_plugins as $plugin_name => $plugin) { |
|
112 | 112 | $cache[$plugin_name] = $plugin->getCollectedData(); |
113 | 113 | } |
114 | 114 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $invalidators = array('main' => 'main:' . self::CACHE_FORMAT_VERSION); |
127 | 127 | |
128 | - foreach ( $this->_plugins as $plugin_name => $plugin ) { |
|
128 | + foreach ($this->_plugins as $plugin_name => $plugin) { |
|
129 | 129 | $invalidator_key = 'plugin(' . $plugin_name . ')'; |
130 | 130 | $invalidators[$invalidator_key] = $invalidator_key . ':' . $plugin->getCacheInvalidator(); |
131 | 131 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $plugin = reset($this->_plugins); |
147 | 147 | $last_revision = $plugin->getLastRevision(); |
148 | 148 | |
149 | - if ( $last_revision === null ) { |
|
149 | + if ($last_revision === null) { |
|
150 | 150 | return $this->_repositoryConnector->getFirstRevision( |
151 | 151 | $this->_repositoryConnector->getProjectUrl($this->_repositoryUrl) |
152 | 152 | ); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | ); |
175 | 175 | $progress_bar->start(); |
176 | 176 | |
177 | - while ( $range_start < $to_revision ) { |
|
177 | + while ($range_start < $to_revision) { |
|
178 | 178 | $range_end = min($range_start + 1000, $to_revision); |
179 | 179 | |
180 | 180 | $command = $this->_repositoryConnector->getCommand( |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | private function _parseLog(\SimpleXMLElement $log) |
203 | 203 | { |
204 | - foreach ( $this->_plugins as $plugin ) { |
|
204 | + foreach ($this->_plugins as $plugin) { |
|
205 | 205 | $plugin->parse($log); |
206 | 206 | } |
207 | 207 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | { |
219 | 219 | $plugin_name = $plugin->getName(); |
220 | 220 | |
221 | - if ( $this->pluginRegistered($plugin_name) ) { |
|
221 | + if ($this->pluginRegistered($plugin_name)) { |
|
222 | 222 | throw new \LogicException('The "' . $plugin_name . '" revision log plugin is already registered.'); |
223 | 223 | } |
224 | 224 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function find($plugin_name, $criteria) |
238 | 238 | { |
239 | - if ( !$this->pluginRegistered($plugin_name) ) { |
|
239 | + if (!$this->pluginRegistered($plugin_name)) { |
|
240 | 240 | throw new \InvalidArgumentException('The "' . $plugin_name . '" revision log plugin is unknown.'); |
241 | 241 | } |
242 | 242 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function getRevisionData($plugin_name, $revision) |
256 | 256 | { |
257 | - if ( !$this->pluginRegistered($plugin_name) ) { |
|
257 | + if (!$this->pluginRegistered($plugin_name)) { |
|
258 | 258 | throw new \InvalidArgumentException('The "' . $plugin_name . '" revision log plugin is unknown.'); |
259 | 259 | } |
260 | 260 | |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | { |
285 | 285 | $bugs = array(); |
286 | 286 | |
287 | - foreach ( $revisions as $revision ) { |
|
287 | + foreach ($revisions as $revision) { |
|
288 | 288 | $revision_bugs = $this->getRevisionData('bugs', $revision); |
289 | 289 | |
290 | - foreach ( $revision_bugs as $bug_id ) { |
|
290 | + foreach ($revision_bugs as $bug_id) { |
|
291 | 291 | $bugs[$bug_id] = true; |
292 | 292 | } |
293 | 293 | } |
@@ -155,7 +155,7 @@ |
||
155 | 155 | /** |
156 | 156 | * Returns cache invalidator for this plugin data. |
157 | 157 | * |
158 | - * @return string |
|
158 | + * @return integer |
|
159 | 159 | */ |
160 | 160 | public function getCacheInvalidator() |
161 | 161 | { |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function parse(\SimpleXMLElement $log) |
50 | 50 | { |
51 | - foreach ( $log->logentry as $log_entry ) { |
|
51 | + foreach ($log->logentry as $log_entry) { |
|
52 | 52 | $revision = (int)$log_entry['revision']; |
53 | 53 | $author = (string)$log_entry->author; |
54 | 54 | |
55 | - if ( !isset($this->_authorRevisions[$author]) ) { |
|
55 | + if (!isset($this->_authorRevisions[$author])) { |
|
56 | 56 | $this->_authorRevisions[$author] = array(); |
57 | 57 | } |
58 | 58 | |
@@ -79,20 +79,20 @@ discard block |
||
79 | 79 | { |
80 | 80 | $summary_revisions = array(); |
81 | 81 | |
82 | - foreach ( $criteria as $criterion ) { |
|
83 | - if ( strpos($criterion, ':') === false ) { |
|
82 | + foreach ($criteria as $criterion) { |
|
83 | + if (strpos($criterion, ':') === false) { |
|
84 | 84 | $error_msg = 'Each criterion of "%s" plugin must be in "%s" format.'; |
85 | 85 | throw new \InvalidArgumentException(sprintf($error_msg, $this->getName(), 'field:value')); |
86 | 86 | } |
87 | 87 | |
88 | 88 | list ($field, $value) = explode(':', $criterion, 2); |
89 | 89 | |
90 | - if ( $field === 'author' ) { |
|
91 | - if ( !array_key_exists($value, $this->_authorRevisions) ) { |
|
90 | + if ($field === 'author') { |
|
91 | + if (!array_key_exists($value, $this->_authorRevisions)) { |
|
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | |
95 | - foreach ( $this->_authorRevisions[$value] as $revision ) { |
|
95 | + foreach ($this->_authorRevisions[$value] as $revision) { |
|
96 | 96 | $summary_revisions[$revision] = true; |
97 | 97 | } |
98 | 98 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getRevisionData($revision) |
120 | 120 | { |
121 | - if ( !isset($this->_revisionSummary[$revision]) ) { |
|
121 | + if (!isset($this->_revisionSummary[$revision])) { |
|
122 | 122 | $error_msg = 'Revision "%s" not found by "%s" plugin.'; |
123 | 123 | throw new \InvalidArgumentException(sprintf($error_msg, $revision, $this->getName())); |
124 | 124 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function getLastRevision() |
171 | 171 | { |
172 | - if ( !$this->_revisionSummary ) { |
|
172 | + if (!$this->_revisionSummary) { |
|
173 | 173 | return null; |
174 | 174 | } |
175 | 175 |
@@ -95,8 +95,7 @@ |
||
95 | 95 | foreach ( $this->_authorRevisions[$value] as $revision ) { |
96 | 96 | $summary_revisions[$revision] = true; |
97 | 97 | } |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | $error_msg = 'Searching by "%s" is not supported by "%s" plugin.'; |
101 | 100 | throw new \InvalidArgumentException(sprintf($error_msg, $field, $this->getName())); |
102 | 101 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function setCache($name, $value, $invalidator = null, $duration = null) |
45 | 45 | { |
46 | - if ( is_numeric($duration) ) { |
|
46 | + if (is_numeric($duration)) { |
|
47 | 47 | $duration .= ' seconds'; |
48 | 48 | } |
49 | 49 | |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | $storage = $this->_getStorage($name); |
70 | 70 | $cache = $storage->get(); |
71 | 71 | |
72 | - if ( !is_array($cache) || $cache['invalidator'] !== $invalidator ) { |
|
72 | + if (!is_array($cache) || $cache['invalidator'] !== $invalidator) { |
|
73 | 73 | $storage->invalidate(); |
74 | 74 | |
75 | 75 | return null; |
76 | 76 | } |
77 | 77 | |
78 | - if ( $cache['expiration'] && $cache['expiration'] < time() ) { |
|
78 | + if ($cache['expiration'] && $cache['expiration'] < time()) { |
|
79 | 79 | $storage->invalidate(); |
80 | 80 | |
81 | 81 | return null; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | $parts = explode(':', $name, 2); |
98 | 98 | |
99 | - if ( count($parts) != 2 ) { |
|
99 | + if (count($parts) != 2) { |
|
100 | 100 | throw new \InvalidArgumentException('The $name parameter must be in "namespace:name" format.'); |
101 | 101 | } |
102 | 102 |