@@ -24,7 +24,7 @@ |
||
24 | 24 | public function detect($repository_url) |
25 | 25 | { |
26 | 26 | // Merging bug fixes branch (e.g. "5.2.x") into feature branch (e.g. "5.3.x") of In-Portal. |
27 | - if ( preg_match('#^(.*/branches/[\d]+\.)([\d]+)\.x(/|$)#', $repository_url, $regs) ) { |
|
27 | + if (preg_match('#^(.*/branches/[\d]+\.)([\d]+)\.x(/|$)#', $repository_url, $regs)) { |
|
28 | 28 | return $regs[1] . ($regs[2] - 1) . '.x'; |
29 | 29 | } |
30 | 30 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $weight = $merge_source_detector->getWeight(); |
35 | 35 | |
36 | - if ( array_key_exists($weight, $this->_detectors) ) { |
|
36 | + if (array_key_exists($weight, $this->_detectors)) { |
|
37 | 37 | throw new \InvalidArgumentException('Another detector with same weight is already added.'); |
38 | 38 | } |
39 | 39 | |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function detect($repository_url) |
52 | 52 | { |
53 | - foreach ( $this->_detectors as $detector ) { |
|
53 | + foreach ($this->_detectors as $detector) { |
|
54 | 54 | $result = $detector->detect($repository_url); |
55 | 55 | |
56 | - if ( isset($result) ) { |
|
56 | + if (isset($result)) { |
|
57 | 57 | return $result; |
58 | 58 | } |
59 | 59 | } |
@@ -110,23 +110,23 @@ discard block |
||
110 | 110 | $command_line = $this->_process->getCommandLine(); |
111 | 111 | $cache_key = $this->_getCacheKey(); |
112 | 112 | |
113 | - if ( $cache_key ) { |
|
113 | + if ($cache_key) { |
|
114 | 114 | $output = $this->_cacheManager->getCache($cache_key, $this->_cacheInvalidator); |
115 | 115 | |
116 | - if ( isset($output) && is_callable($callback) ) { |
|
116 | + if (isset($output) && is_callable($callback)) { |
|
117 | 117 | call_user_func($callback, Process::OUT, $output); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - if ( !isset($output) ) { |
|
121 | + if (!isset($output)) { |
|
122 | 122 | $output = $this->_doRun($callback); |
123 | 123 | |
124 | - if ( $cache_key ) { |
|
124 | + if ($cache_key) { |
|
125 | 125 | $this->_cacheManager->setCache($cache_key, $output, $this->_cacheInvalidator, $this->_cacheDuration); |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - if ( strpos($command_line, '--xml') !== false ) { |
|
129 | + if (strpos($command_line, '--xml') !== false) { |
|
130 | 130 | return simplexml_load_string($output); |
131 | 131 | } |
132 | 132 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | private function _getCacheKey() |
142 | 142 | { |
143 | - if ( $this->_cacheInvalidator || $this->_cacheDuration ) { |
|
143 | + if ($this->_cacheInvalidator || $this->_cacheDuration) { |
|
144 | 144 | return 'command:' . $this->_process->getCommandLine(); |
145 | 145 | } |
146 | 146 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $start = microtime(true); |
162 | 162 | $this->_process->mustRun($callback); |
163 | 163 | |
164 | - if ( $this->_io->isVerbose() ) { |
|
164 | + if ($this->_io->isVerbose()) { |
|
165 | 165 | $runtime = sprintf('%01.2f', microtime(true) - $start); |
166 | 166 | $command_line = $this->_process->getCommandLine(); |
167 | 167 | $this->_io->writeln( |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | ); |
170 | 170 | } |
171 | 171 | } |
172 | - catch ( ProcessFailedException $e ) { |
|
172 | + catch (ProcessFailedException $e) { |
|
173 | 173 | $process = $e->getProcess(); |
174 | 174 | |
175 | 175 | throw new RepositoryCommandException( |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | $output = (string)$this->_process->getOutput(); |
182 | 182 | |
183 | - if ( $this->_io->isDebug() ) { |
|
183 | + if ($this->_io->isDebug()) { |
|
184 | 184 | $this->_io->writeln($output, OutputInterface::OUTPUT_RAW); |
185 | 185 | } |
186 | 186 | |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | $replace_from = array_keys($replacements); |
214 | 214 | $replace_to = array_values($replacements); |
215 | 215 | |
216 | - return function ($type, $buffer) use ($io, $replace_from, $replace_to) { |
|
216 | + return function($type, $buffer) use ($io, $replace_from, $replace_to) { |
|
217 | 217 | $buffer = str_replace($replace_from, $replace_to, $buffer); |
218 | 218 | |
219 | - if ( $type === Process::ERR ) { |
|
219 | + if ($type === Process::ERR) { |
|
220 | 220 | $buffer = '<error>ERR:</error> ' . $buffer; |
221 | 221 | } |
222 | 222 |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | |
104 | 104 | $this->_svnCommand .= ' --non-interactive'; |
105 | 105 | |
106 | - if ( $username ) { |
|
106 | + if ($username) { |
|
107 | 107 | $this->_svnCommand .= ' --username ' . $username; |
108 | 108 | } |
109 | 109 | |
110 | - if ( $password ) { |
|
110 | + if ($password) { |
|
111 | 111 | $this->_svnCommand .= ' --password ' . $password; |
112 | 112 | } |
113 | 113 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $this->_cacheManager |
131 | 131 | ); |
132 | 132 | |
133 | - if ( isset($this->_nextCommandCacheDuration) ) { |
|
133 | + if (isset($this->_nextCommandCacheDuration)) { |
|
134 | 134 | $command->setCacheDuration($this->_nextCommandCacheDuration); |
135 | 135 | $this->_nextCommandCacheDuration = null; |
136 | 136 | } |
@@ -149,23 +149,23 @@ discard block |
||
149 | 149 | */ |
150 | 150 | protected function buildCommand($sub_command, $param_string = null) |
151 | 151 | { |
152 | - if ( strpos($sub_command, ' ') !== false ) { |
|
152 | + if (strpos($sub_command, ' ') !== false) { |
|
153 | 153 | throw new \InvalidArgumentException('The "' . $sub_command . '" sub-command contains spaces.'); |
154 | 154 | } |
155 | 155 | |
156 | 156 | $command_line = $this->_svnCommand; |
157 | 157 | |
158 | - if ( !empty($sub_command) ) { |
|
158 | + if (!empty($sub_command)) { |
|
159 | 159 | $command_line .= ' ' . $sub_command; |
160 | 160 | } |
161 | 161 | |
162 | - if ( !empty($param_string) ) { |
|
162 | + if (!empty($param_string)) { |
|
163 | 163 | $command_line .= ' ' . $param_string; |
164 | 164 | } |
165 | 165 | |
166 | 166 | $command_line = preg_replace_callback( |
167 | 167 | '/\{([^\}]*)\}/', |
168 | - function (array $matches) { |
|
168 | + function(array $matches) { |
|
169 | 169 | return escapeshellarg($matches[1]); |
170 | 170 | }, |
171 | 171 | $command_line |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | { |
202 | 202 | $param_string = $name . ' {' . $path_or_url . '}'; |
203 | 203 | |
204 | - if ( isset($revision) ) { |
|
204 | + if (isset($revision)) { |
|
205 | 205 | $param_string .= ' --revision ' . $revision; |
206 | 206 | } |
207 | 207 | |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function getPathFromUrl($absolute_url) |
220 | 220 | { |
221 | - if ( !$this->isUrl($absolute_url) ) { |
|
221 | + if (!$this->isUrl($absolute_url)) { |
|
222 | 222 | throw new \InvalidArgumentException('The repository URL "' . $absolute_url . '" is invalid.'); |
223 | 223 | } |
224 | 224 | |
225 | 225 | $relative_url = parse_url($absolute_url, PHP_URL_PATH); |
226 | 226 | |
227 | - if ( $relative_url === false ) { |
|
227 | + if ($relative_url === false) { |
|
228 | 228 | throw new \InvalidArgumentException('The repository URL "' . $absolute_url . '" is invalid.'); |
229 | 229 | } |
230 | 230 | |
@@ -241,20 +241,20 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function getWorkingCopyUrl($wc_path) |
243 | 243 | { |
244 | - if ( $this->isUrl($wc_path) ) { |
|
244 | + if ($this->isUrl($wc_path)) { |
|
245 | 245 | return $wc_path; |
246 | 246 | } |
247 | 247 | |
248 | 248 | try { |
249 | 249 | $wc_url = (string)$this->getSvnInfoEntry($wc_path)->url; |
250 | 250 | } |
251 | - catch ( RepositoryCommandException $e ) { |
|
252 | - if ( $e->getCode() == RepositoryCommandException::SVN_ERR_WC_UPGRADE_REQUIRED ) { |
|
251 | + catch (RepositoryCommandException $e) { |
|
252 | + if ($e->getCode() == RepositoryCommandException::SVN_ERR_WC_UPGRADE_REQUIRED) { |
|
253 | 253 | $message = explode(PHP_EOL, $e->getMessage()); |
254 | 254 | |
255 | 255 | $this->_io->writeln(array('', '<error>' . end($message) . '</error>', '')); |
256 | 256 | |
257 | - if ( $this->_io->askConfirmation('Run "svn upgrade"', false) ) { |
|
257 | + if ($this->_io->askConfirmation('Run "svn upgrade"', false)) { |
|
258 | 258 | $this->getCommand('upgrade', '{' . $wc_path . '}')->runLive(); |
259 | 259 | |
260 | 260 | return $this->getWorkingCopyUrl($wc_path); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public function getLastRevision($path_or_url, $cache_duration = null) |
279 | 279 | { |
280 | 280 | // Cache "svn info" commands to remote urls, not the working copy. |
281 | - if ( !isset($cache_duration) && $this->isUrl($path_or_url) ) { |
|
281 | + if (!isset($cache_duration) && $this->isUrl($path_or_url)) { |
|
282 | 282 | $cache_duration = self::LAST_REVISION_CACHE; |
283 | 283 | } |
284 | 284 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function getProjectUrl($repository_url) |
310 | 310 | { |
311 | - if ( preg_match('#^(.*?)/(trunk|branches|tags|releases).*$#', $repository_url, $regs) ) { |
|
311 | + if (preg_match('#^(.*?)/(trunk|branches|tags|releases).*$#', $repository_url, $regs)) { |
|
312 | 312 | return $regs[1]; |
313 | 313 | } |
314 | 314 | |
@@ -327,13 +327,13 @@ discard block |
||
327 | 327 | { |
328 | 328 | $svn_info = $this->getCommand('info', '--xml {' . $path_or_url . '}')->run(); |
329 | 329 | |
330 | - foreach ( $svn_info->entry as $entry ) { |
|
331 | - if ( $entry['kind'] != 'dir' ) { |
|
330 | + foreach ($svn_info->entry as $entry) { |
|
331 | + if ($entry['kind'] != 'dir') { |
|
332 | 332 | continue; |
333 | 333 | } |
334 | 334 | |
335 | 335 | // When getting remote "svn info", then path is last folder only. |
336 | - if ( basename($this->getSvnInfoEntryPath($entry)) == basename($path_or_url) ) { |
|
336 | + if (basename($this->getSvnInfoEntryPath($entry)) == basename($path_or_url)) { |
|
337 | 337 | return $entry; |
338 | 338 | } |
339 | 339 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | // SVN 1.7+. |
356 | 356 | $path = (string)$svn_info_entry->{'wc-info'}->{'wcroot-abspath'}; |
357 | 357 | |
358 | - if ( !$path ) { |
|
358 | + if (!$path) { |
|
359 | 359 | // SVN 1.6-. |
360 | 360 | $path = (string)$svn_info_entry['path']; |
361 | 361 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function getFirstRevision($url) |
375 | 375 | { |
376 | - if ( !$this->isUrl($url) ) { |
|
376 | + if (!$this->isUrl($url)) { |
|
377 | 377 | throw new \InvalidArgumentException('The repository URL "' . $url . '" is invalid.'); |
378 | 378 | } |
379 | 379 | |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | { |
394 | 394 | $ret = array(); |
395 | 395 | |
396 | - foreach ( $this->getWorkingCopyStatus($wc_path) as $path => $status ) { |
|
397 | - if ( $status['item'] == 'conflicted' || $status['props'] == 'conflicted' || $status['tree-conflicted'] ) { |
|
396 | + foreach ($this->getWorkingCopyStatus($wc_path) as $path => $status) { |
|
397 | + if ($status['item'] == 'conflicted' || $status['props'] == 'conflicted' || $status['tree-conflicted']) { |
|
398 | 398 | $ret[] = $path; |
399 | 399 | } |
400 | 400 | } |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | { |
415 | 415 | $ret = array(); |
416 | 416 | |
417 | - foreach ( $this->getWorkingCopyStatus($wc_path) as $path => $status ) { |
|
418 | - if ( !$with_unversioned && $status['item'] == self::STATUS_UNVERSIONED ) { |
|
417 | + foreach ($this->getWorkingCopyStatus($wc_path) as $path => $status) { |
|
418 | + if (!$with_unversioned && $status['item'] == self::STATUS_UNVERSIONED) { |
|
419 | 419 | continue; |
420 | 420 | } |
421 | 421 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | 'unversioned' => '?', |
456 | 456 | ); |
457 | 457 | |
458 | - if ( !isset($status_map[$status]) ) { |
|
458 | + if (!isset($status_map[$status])) { |
|
459 | 459 | throw new \InvalidArgumentException('The "' . $status . '" item status is unknown.'); |
460 | 460 | } |
461 | 461 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | 'none' => ' ', |
480 | 480 | ); |
481 | 481 | |
482 | - if ( !isset($status_map[$status]) ) { |
|
482 | + if (!isset($status_map[$status])) { |
|
483 | 483 | throw new \InvalidArgumentException('The "' . $status . '" properties status is unknown.'); |
484 | 484 | } |
485 | 485 | |
@@ -498,15 +498,15 @@ discard block |
||
498 | 498 | $ret = array(); |
499 | 499 | $status = $this->getCommand('status', '--xml {' . $wc_path . '}')->run(); |
500 | 500 | |
501 | - foreach ( $status->target as $target ) { |
|
502 | - if ( (string)$target['path'] !== $wc_path ) { |
|
501 | + foreach ($status->target as $target) { |
|
502 | + if ((string)$target['path'] !== $wc_path) { |
|
503 | 503 | continue; |
504 | 504 | } |
505 | 505 | |
506 | - foreach ( $target as $entry ) { |
|
506 | + foreach ($target as $entry) { |
|
507 | 507 | $path = (string)$entry['path']; |
508 | 508 | |
509 | - if ( $path === $wc_path ) { |
|
509 | + if ($path === $wc_path) { |
|
510 | 510 | $path = '.'; |
511 | 511 | } |
512 | 512 | else { |
@@ -536,15 +536,15 @@ discard block |
||
536 | 536 | $revisions = array(); |
537 | 537 | $status = $this->getCommand('status', '--xml --verbose {' . $wc_path . '}')->run(); |
538 | 538 | |
539 | - foreach ( $status->target as $target ) { |
|
540 | - if ( (string)$target['path'] !== $wc_path ) { |
|
539 | + foreach ($status->target as $target) { |
|
540 | + if ((string)$target['path'] !== $wc_path) { |
|
541 | 541 | continue; |
542 | 542 | } |
543 | 543 | |
544 | - foreach ( $target as $entry ) { |
|
544 | + foreach ($target as $entry) { |
|
545 | 545 | $item_status = (string)$entry->{'wc-status'}['item']; |
546 | 546 | |
547 | - if ( $item_status !== self::STATUS_UNVERSIONED ) { |
|
547 | + if ($item_status !== self::STATUS_UNVERSIONED) { |
|
548 | 548 | $revision = (int)$entry->{'wc-status'}['revision']; |
549 | 549 | $revisions[$revision] = true; |
550 | 550 | } |
@@ -565,15 +565,15 @@ discard block |
||
565 | 565 | */ |
566 | 566 | public function isWorkingCopy($path) |
567 | 567 | { |
568 | - if ( $this->isUrl($path) || !file_exists($path) || !is_dir($path) ) { |
|
568 | + if ($this->isUrl($path) || !file_exists($path) || !is_dir($path)) { |
|
569 | 569 | throw new \InvalidArgumentException('Path "' . $path . '" not found or isn\'t a directory.'); |
570 | 570 | } |
571 | 571 | |
572 | 572 | try { |
573 | 573 | $wc_url = $this->getWorkingCopyUrl($path); |
574 | 574 | } |
575 | - catch ( RepositoryCommandException $e ) { |
|
576 | - if ( $e->getCode() == RepositoryCommandException::SVN_ERR_WC_NOT_WORKING_COPY ) { |
|
575 | + catch (RepositoryCommandException $e) { |
|
576 | + if ($e->getCode() == RepositoryCommandException::SVN_ERR_WC_NOT_WORKING_COPY) { |
|
577 | 577 | return false; |
578 | 578 | } |
579 | 579 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $mantis_regexp = '(?:[Bb]ugs?|[Ii]ssues?|[Rr]eports?|[Ff]ixe?s?|[Rr]esolves?)+\s+(?:#?(?:\d+)[,\.\s]*)+'; |
53 | 53 | $mantis_regexp .= "\n" . '(\d+)' . "\n"; |
54 | 54 | |
55 | - if ( $bugtraq_logregex === $mantis_regexp ) { |
|
55 | + if ($bugtraq_logregex === $mantis_regexp) { |
|
56 | 56 | return '([A-Z]+\-\d+)'; |
57 | 57 | } |
58 | 58 | |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | { |
71 | 71 | $bugtraq_logregex = array_filter(explode(PHP_EOL, $bugtraq_logregex)); |
72 | 72 | |
73 | - if ( count($bugtraq_logregex) == 2 ) { |
|
73 | + if (count($bugtraq_logregex) == 2) { |
|
74 | 74 | $this->_preFilterRegExp = '/' . $bugtraq_logregex[0] . '/s'; |
75 | 75 | $this->_filterRegExp = '/' . $bugtraq_logregex[1] . '/s'; |
76 | 76 | } |
77 | - elseif ( count($bugtraq_logregex) == 1 ) { |
|
77 | + elseif (count($bugtraq_logregex) == 1) { |
|
78 | 78 | $this->_preFilterRegExp = ''; |
79 | 79 | $this->_filterRegExp = '/' . $bugtraq_logregex[0] . '/s'; |
80 | 80 | } |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function parse($log_message) |
95 | 95 | { |
96 | - if ( !$this->_filterRegExp ) { |
|
96 | + if (!$this->_filterRegExp) { |
|
97 | 97 | return array(); |
98 | 98 | } |
99 | 99 | |
100 | - if ( $this->_preFilterRegExp ) { |
|
101 | - if ( !preg_match_all($this->_preFilterRegExp, $log_message, $pre_filter_regs) ) { |
|
100 | + if ($this->_preFilterRegExp) { |
|
101 | + if (!preg_match_all($this->_preFilterRegExp, $log_message, $pre_filter_regs)) { |
|
102 | 102 | return array(); |
103 | 103 | } |
104 | 104 | |
105 | 105 | $ret = array(); |
106 | 106 | |
107 | - foreach ( $pre_filter_regs[0] as $match ) { |
|
108 | - if ( preg_match_all($this->_filterRegExp, $match, $filter_regs) ) { |
|
107 | + foreach ($pre_filter_regs[0] as $match) { |
|
108 | + if (preg_match_all($this->_filterRegExp, $match, $filter_regs)) { |
|
109 | 109 | $ret = array_merge($ret, $filter_regs[1]); |
110 | 110 | } |
111 | 111 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return array_unique($ret); |
114 | 114 | } |
115 | 115 | |
116 | - if ( preg_match_all($this->_filterRegExp, $log_message, $filter_regs) ) { |
|
116 | + if (preg_match_all($this->_filterRegExp, $log_message, $filter_regs)) { |
|
117 | 117 | return array_unique($filter_regs[1]); |
118 | 118 | } |
119 | 119 |
@@ -30,22 +30,22 @@ |
||
30 | 30 | $ret = array(); |
31 | 31 | $range_regexp = '/^([\d]+)' . preg_quote($range_separator, '/') . '([\d]+)\*?$/'; |
32 | 32 | |
33 | - foreach ( $revisions as $raw_revision ) { |
|
34 | - if ( preg_match($range_regexp, $raw_revision, $regs) ) { |
|
33 | + foreach ($revisions as $raw_revision) { |
|
34 | + if (preg_match($range_regexp, $raw_revision, $regs)) { |
|
35 | 35 | $range_start = (int)$regs[1]; |
36 | 36 | $range_end = (int)$regs[2]; |
37 | 37 | |
38 | - if ( $range_start > $range_end ) { |
|
38 | + if ($range_start > $range_end) { |
|
39 | 39 | throw new \InvalidArgumentException( |
40 | 40 | 'Inverted revision range "' . $raw_revision . '" is not implemented.' |
41 | 41 | ); |
42 | 42 | } |
43 | 43 | |
44 | - for ( $i = $range_start; $i <= $range_end; $i++ ) { |
|
44 | + for ($i = $range_start; $i <= $range_end; $i++) { |
|
45 | 45 | $ret[$i] = true; |
46 | 46 | } |
47 | 47 | } |
48 | - elseif ( preg_match('/^([\d]+)\*?$/', $raw_revision, $regs) ) { |
|
48 | + elseif (preg_match('/^([\d]+)\*?$/', $raw_revision, $regs)) { |
|
49 | 49 | $ret[(int)$regs[1]] = true; |
50 | 50 | } |
51 | 51 | else { |
@@ -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 |
@@ -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 |
@@ -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 |