@@ -125,13 +125,13 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function _getConfigSetting($name) |
| 127 | 127 | { |
| 128 | - if ( !($this instanceof IConfigAwareCommand) ) { |
|
| 128 | + if (!($this instanceof IConfigAwareCommand)) { |
|
| 129 | 129 | throw new \LogicException('Command does not have any settings.'); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - foreach ( $this->getConfigSettings() as $config_setting ) { |
|
| 133 | - if ( $config_setting->getName() === $name ) { |
|
| 134 | - if ( $config_setting->isWithinScope(AbstractConfigSetting::SCOPE_WORKING_COPY) ) { |
|
| 132 | + foreach ($this->getConfigSettings() as $config_setting) { |
|
| 133 | + if ($config_setting->getName() === $name) { |
|
| 134 | + if ($config_setting->isWithinScope(AbstractConfigSetting::SCOPE_WORKING_COPY)) { |
|
| 135 | 135 | $config_setting->setWorkingCopyUrl($this->getWorkingCopyUrl()); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | protected function getConfigScope($is_global) |
| 155 | 155 | { |
| 156 | - if ( $is_global ) { |
|
| 156 | + if ($is_global) { |
|
| 157 | 157 | return 'global-settings.'; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | protected function getRevisionLog($repository_url) |
| 175 | 175 | { |
| 176 | - if ( !isset($this->_revisionLogs[$repository_url]) ) { |
|
| 176 | + if (!isset($this->_revisionLogs[$repository_url])) { |
|
| 177 | 177 | $this->_revisionLogs[$repository_url] = $this->_revisionLogFactory->getRevisionLog($repository_url); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | { |
| 214 | 214 | $path = $this->getPath(); |
| 215 | 215 | |
| 216 | - if ( !in_array($path, $this->_workingCopyPaths) ) { |
|
| 217 | - if ( !$this->repositoryConnector->isUrl($path) |
|
| 216 | + if (!in_array($path, $this->_workingCopyPaths)) { |
|
| 217 | + if (!$this->repositoryConnector->isUrl($path) |
|
| 218 | 218 | && !$this->repositoryConnector->isWorkingCopy($path) |
| 219 | 219 | ) { |
| 220 | 220 | throw new \RuntimeException('The "' . $path . '" isn\'t a working copy.'); |
@@ -236,10 +236,10 @@ discard block |
||
| 236 | 236 | { |
| 237 | 237 | $path = $this->io->getArgument('path'); |
| 238 | 238 | |
| 239 | - if ( !$this->repositoryConnector->isUrl($path) ) { |
|
| 239 | + if (!$this->repositoryConnector->isUrl($path)) { |
|
| 240 | 240 | $path = realpath($path); |
| 241 | 241 | } |
| 242 | - elseif ( !$this->pathAcceptsUrl ) { |
|
| 242 | + elseif (!$this->pathAcceptsUrl) { |
|
| 243 | 243 | throw new \RuntimeException('The "path" argument must be a working copy path and not URL.'); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -238,8 +238,7 @@ |
||
| 238 | 238 | |
| 239 | 239 | if ( !$this->repositoryConnector->isUrl($path) ) { |
| 240 | 240 | $path = realpath($path); |
| 241 | - } |
|
| 242 | - elseif ( !$this->pathAcceptsUrl ) { |
|
| 241 | + } elseif ( !$this->pathAcceptsUrl ) { |
|
| 243 | 242 | throw new \RuntimeException('The "path" argument must be a working copy path and not URL.'); |
| 244 | 243 | } |
| 245 | 244 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | $wc_path = $this->getWorkingCopyPath(); |
| 87 | 87 | $conflicts = $this->repositoryConnector->getWorkingCopyConflicts($wc_path); |
| 88 | 88 | |
| 89 | - if ( $conflicts ) { |
|
| 89 | + if ($conflicts) { |
|
| 90 | 90 | throw new CommandException('Conflicts detected. Please resolve them before committing.'); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $working_copy_status = $this->repositoryConnector->getCompactWorkingCopyStatus($wc_path, false); |
| 94 | 94 | |
| 95 | - if ( !$working_copy_status ) { |
|
| 95 | + if (!$working_copy_status) { |
|
| 96 | 96 | throw new CommandException('Nothing to commit.'); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | $stop_line_pos = strpos($edited_commit_message, self::STOP_LINE); |
| 108 | 108 | |
| 109 | - if ( $stop_line_pos !== false ) { |
|
| 109 | + if ($stop_line_pos !== false) { |
|
| 110 | 110 | $edited_commit_message = trim(substr($edited_commit_message, 0, $stop_line_pos)); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $this->io->writeln(array('<fg=white;options=bold>Commit message:</>', $edited_commit_message, '')); |
| 114 | 114 | |
| 115 | - if ( !$this->io->askConfirmation('Run "svn commit"', false) ) { |
|
| 115 | + if (!$this->io->askConfirmation('Run "svn commit"', false)) { |
|
| 116 | 116 | throw new CommandException('Commit aborted by user.'); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $merged_revisions = $this->getFreshMergedRevisions($wc_path); |
| 150 | 150 | |
| 151 | - if ( !$merged_revisions ) { |
|
| 151 | + if (!$merged_revisions) { |
|
| 152 | 152 | return ''; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path); |
| 157 | 157 | $repository_url = $this->removePathFromURL($wc_url); |
| 158 | 158 | |
| 159 | - foreach ( $merged_revisions as $path => $revisions ) { |
|
| 159 | + foreach ($merged_revisions as $path => $revisions) { |
|
| 160 | 160 | $merged_messages = array(); |
| 161 | 161 | $revision_log = $this->getRevisionLog($repository_url . $path); |
| 162 | 162 | $commit_message .= 'Merging from ' . ucfirst(basename($path)) . ' to ' . ucfirst(basename($wc_url)) . PHP_EOL; |
| 163 | 163 | |
| 164 | - foreach ( $revisions as $revision ) { |
|
| 164 | + foreach ($revisions as $revision) { |
|
| 165 | 165 | $revision_data = $revision_log->getRevisionData('summary', $revision); |
| 166 | 166 | $merged_messages[] = ' * r' . $revision . ': ' . $revision_data['msg']; |
| 167 | 167 | } |
@@ -200,18 +200,18 @@ discard block |
||
| 200 | 200 | $old_paths = $this->getMergedRevisions($wc_path, 'BASE'); |
| 201 | 201 | $new_paths = $this->getMergedRevisions($wc_path); |
| 202 | 202 | |
| 203 | - if ( $old_paths === $new_paths ) { |
|
| 203 | + if ($old_paths === $new_paths) { |
|
| 204 | 204 | return array(); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - foreach ( $new_paths as $new_path => $new_merged_revisions ) { |
|
| 208 | - if ( !isset($old_paths[$new_path]) ) { |
|
| 207 | + foreach ($new_paths as $new_path => $new_merged_revisions) { |
|
| 208 | + if (!isset($old_paths[$new_path])) { |
|
| 209 | 209 | // Merge from new path. |
| 210 | 210 | $final_paths[$new_path] = $this->_revisionListParser->expandRanges( |
| 211 | 211 | explode(',', $new_merged_revisions) |
| 212 | 212 | ); |
| 213 | 213 | } |
| 214 | - elseif ( $new_merged_revisions != $old_paths[$new_path] ) { |
|
| 214 | + elseif ($new_merged_revisions != $old_paths[$new_path]) { |
|
| 215 | 215 | // Merge on existing path. |
| 216 | 216 | $new_merged_revisions_parsed = $this->_revisionListParser->expandRanges( |
| 217 | 217 | explode(',', $new_merged_revisions) |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $merge_info = $this->repositoryConnector->getProperty('svn:mergeinfo', $wc_path, $revision); |
| 244 | 244 | $merge_info = array_filter(explode("\n", $merge_info)); |
| 245 | 245 | |
| 246 | - foreach ( $merge_info as $merge_info_line ) { |
|
| 246 | + foreach ($merge_info as $merge_info_line) { |
|
| 247 | 247 | list($path, $revisions) = explode(':', $merge_info_line, 2); |
| 248 | 248 | $paths[$path] = $revisions; |
| 249 | 249 | } |
@@ -210,8 +210,7 @@ |
||
| 210 | 210 | $final_paths[$new_path] = $this->_revisionListParser->expandRanges( |
| 211 | 211 | explode(',', $new_merged_revisions) |
| 212 | 212 | ); |
| 213 | - } |
|
| 214 | - elseif ( $new_merged_revisions != $old_paths[$new_path] ) { |
|
| 213 | + } elseif ( $new_merged_revisions != $old_paths[$new_path] ) { |
|
| 215 | 214 | // Merge on existing path. |
| 216 | 215 | $new_merged_revisions_parsed = $this->_revisionListParser->expandRanges( |
| 217 | 216 | explode(',', $new_merged_revisions) |
@@ -31,8 +31,8 @@ |
||
| 31 | 31 | { |
| 32 | 32 | $handler->addHandler(new ShellPathCompletion( |
| 33 | 33 | CompletionInterface::ALL_COMMANDS, |
| 34 | - 'path', |
|
| 35 | - Completion::TYPE_ARGUMENT |
|
| 34 | + 'path', |
|
| 35 | + Completion::TYPE_ARGUMENT |
|
| 36 | 36 | )); |
| 37 | 37 | |
| 38 | 38 | $handler->addHandler(new ShellPathCompletion( |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $bugs = $this->getList($this->io->getOption('bugs')); |
| 161 | 161 | $revisions = $this->getList($this->io->getOption('revisions')); |
| 162 | 162 | |
| 163 | - if ( $bugs && $revisions ) { |
|
| 163 | + if ($bugs && $revisions) { |
|
| 164 | 164 | throw new \RuntimeException('The "--bugs" and "--revisions" options are mutually exclusive.'); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | $revision_log = $this->getRevisionLog($wc_url); |
| 171 | 171 | $revisions_by_path = $revision_log->find('paths', $this->repositoryConnector->getPathFromUrl($wc_url)); |
| 172 | 172 | |
| 173 | - if ( $revisions ) { |
|
| 173 | + if ($revisions) { |
|
| 174 | 174 | $revisions = $this->_revisionListParser->expandRanges($revisions); |
| 175 | 175 | $revisions_by_path = array_intersect($revisions_by_path, $revisions); |
| 176 | 176 | $missing_revisions = array_diff($revisions, $revisions_by_path); |
| 177 | 177 | } |
| 178 | - elseif ( $bugs ) { |
|
| 178 | + elseif ($bugs) { |
|
| 179 | 179 | // Only show bug-related revisions on given path. The $missing_revisions is always empty. |
| 180 | 180 | $revisions_from_bugs = $revision_log->find('bugs', $bugs); |
| 181 | 181 | $revisions_by_path = array_intersect($revisions_by_path, $revisions_from_bugs); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $merged_by = $this->getList($this->io->getOption('merged-by')); |
| 185 | 185 | |
| 186 | - if ( $merged_by ) { |
|
| 186 | + if ($merged_by) { |
|
| 187 | 187 | // Exclude revisions, that were merged outside of project root folder in repository. |
| 188 | 188 | $merged_by = $this->_revisionListParser->expandRanges($merged_by); |
| 189 | 189 | $revisions_by_path = $revision_log->find( |
@@ -195,32 +195,32 @@ discard block |
||
| 195 | 195 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', $merged_by)); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if ( $this->io->getOption('merges') ) { |
|
| 198 | + if ($this->io->getOption('merges')) { |
|
| 199 | 199 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', 'all_merges')); |
| 200 | 200 | } |
| 201 | - elseif ( $this->io->getOption('no-merges') ) { |
|
| 201 | + elseif ($this->io->getOption('no-merges')) { |
|
| 202 | 202 | $revisions_by_path = array_diff($revisions_by_path, $revision_log->find('merges', 'all_merges')); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if ( $this->io->getOption('merged') ) { |
|
| 205 | + if ($this->io->getOption('merged')) { |
|
| 206 | 206 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', 'all_merged')); |
| 207 | 207 | } |
| 208 | - elseif ( $this->io->getOption('not-merged') ) { |
|
| 208 | + elseif ($this->io->getOption('not-merged')) { |
|
| 209 | 209 | $revisions_by_path = array_diff($revisions_by_path, $revision_log->find('merges', 'all_merged')); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if ( $missing_revisions ) { |
|
| 212 | + if ($missing_revisions) { |
|
| 213 | 213 | throw new CommandException( |
| 214 | 214 | 'No information about ' . implode(', ', $missing_revisions) . ' revision(-s).' |
| 215 | 215 | ); |
| 216 | 216 | } |
| 217 | - elseif ( !$revisions_by_path ) { |
|
| 217 | + elseif (!$revisions_by_path) { |
|
| 218 | 218 | throw new CommandException('No matching revisions found.'); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | rsort($revisions_by_path, SORT_NUMERIC); |
| 222 | 222 | |
| 223 | - if ( $bugs || $revisions ) { |
|
| 223 | + if ($bugs || $revisions) { |
|
| 224 | 224 | // Don't limit revisions, when provided explicitly by user. |
| 225 | 225 | $revisions_by_path_with_limit = $revisions_by_path; |
| 226 | 226 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | { |
| 251 | 251 | $option_limit = $this->io->getOption('limit'); |
| 252 | 252 | |
| 253 | - if ( $option_limit !== null ) { |
|
| 253 | + if ($option_limit !== null) { |
|
| 254 | 254 | return $option_limit; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -272,14 +272,14 @@ discard block |
||
| 272 | 272 | $headers = array('Revision', 'Author', 'Date', 'Bug-ID', 'Log Message'); |
| 273 | 273 | |
| 274 | 274 | // Add "Summary" header. |
| 275 | - if ( $this->io->getOption('summary') ) { |
|
| 275 | + if ($this->io->getOption('summary')) { |
|
| 276 | 276 | $headers[] = 'Summary'; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | $merge_oracle = $this->io->getOption('merge-oracle'); |
| 280 | 280 | |
| 281 | 281 | // Add "M.O." header. |
| 282 | - if ( $merge_oracle ) { |
|
| 282 | + if ($merge_oracle) { |
|
| 283 | 283 | $headers[] = 'M.O.'; |
| 284 | 284 | $merge_conflict_regexps = $this->getMergeConflictRegExps(); |
| 285 | 285 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | // Add "Merged Via" header. |
| 288 | 288 | $merge_status = $this->io->getOption('merge-status'); |
| 289 | 289 | |
| 290 | - if ( $merge_status ) { |
|
| 290 | + if ($merge_status) { |
|
| 291 | 291 | $headers[] = 'Merged Via'; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -302,18 +302,18 @@ discard block |
||
| 302 | 302 | $revision_log = $this->getRevisionLog($repository_url); |
| 303 | 303 | $repository_path = $this->repositoryConnector->getPathFromUrl($repository_url) . '/'; |
| 304 | 304 | |
| 305 | - foreach ( $revisions as $revision ) { |
|
| 305 | + foreach ($revisions as $revision) { |
|
| 306 | 306 | $revision_data = $revision_log->getRevisionData('summary', $revision); |
| 307 | 307 | list($log_message,) = explode(PHP_EOL, $revision_data['msg']); |
| 308 | 308 | $log_message = preg_replace('/^\[fixes:.*?\]/', "\xE2\x9C\x94", $log_message); |
| 309 | 309 | |
| 310 | - if ( mb_strlen($log_message) > 68 ) { |
|
| 310 | + if (mb_strlen($log_message) > 68) { |
|
| 311 | 311 | $log_message = mb_substr($log_message, 0, 68 - 3) . '...'; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $new_bugs = implode(', ', $revision_log->getRevisionData('bugs', $revision)); |
| 315 | 315 | |
| 316 | - if ( isset($prev_bugs) && $new_bugs <> $prev_bugs ) { |
|
| 316 | + if (isset($prev_bugs) && $new_bugs <> $prev_bugs) { |
|
| 317 | 317 | $last_color = $last_color == 'yellow' ? 'magenta' : 'yellow'; |
| 318 | 318 | } |
| 319 | 319 | |
@@ -328,12 +328,12 @@ discard block |
||
| 328 | 328 | $revision_paths = $revision_log->getRevisionData('paths', $revision); |
| 329 | 329 | |
| 330 | 330 | // Add "Summary" column. |
| 331 | - if ( $this->io->getOption('summary') ) { |
|
| 331 | + if ($this->io->getOption('summary')) { |
|
| 332 | 332 | $row[] = $this->generateChangeSummary($revision_paths); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | // Add "M.O." column. |
| 336 | - if ( $merge_oracle ) { |
|
| 336 | + if ($merge_oracle) { |
|
| 337 | 337 | $merge_conflict_predication = $this->getMergeConflictPrediction( |
| 338 | 338 | $revision_paths, |
| 339 | 339 | $merge_conflict_regexps |
@@ -345,26 +345,26 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | // Add "Merged Via" column. |
| 348 | - if ( $merge_status ) { |
|
| 348 | + if ($merge_status) { |
|
| 349 | 349 | $merged_via = $revision_log->getRevisionData('merges', $revision); |
| 350 | 350 | $row[] = $merged_via ? implode(', ', $merged_via) : ''; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $table->addRow($row); |
| 354 | 354 | |
| 355 | - if ( $with_details ) { |
|
| 355 | + if ($with_details) { |
|
| 356 | 356 | $details = '<fg=white;options=bold>Changed Paths:</>'; |
| 357 | 357 | |
| 358 | - foreach ( $revision_paths as $path_data ) { |
|
| 358 | + foreach ($revision_paths as $path_data) { |
|
| 359 | 359 | $path_action = $path_data['action']; |
| 360 | 360 | $relative_path = $this->_getRelativeLogPath($path_data, 'path', $repository_path); |
| 361 | 361 | |
| 362 | 362 | $details .= PHP_EOL . ' * '; |
| 363 | 363 | |
| 364 | - if ( $path_action == 'A' ) { |
|
| 364 | + if ($path_action == 'A') { |
|
| 365 | 365 | $color_format = 'fg=green'; |
| 366 | 366 | } |
| 367 | - elseif ( $path_action == 'D' ) { |
|
| 367 | + elseif ($path_action == 'D') { |
|
| 368 | 368 | $color_format = 'fg=red'; |
| 369 | 369 | } |
| 370 | 370 | else { |
@@ -373,13 +373,13 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | $to_colorize = $path_action . ' ' . $relative_path; |
| 375 | 375 | |
| 376 | - if ( isset($path_data['copyfrom-path']) ) { |
|
| 376 | + if (isset($path_data['copyfrom-path'])) { |
|
| 377 | 377 | $copy_from_rev = $path_data['copyfrom-rev']; |
| 378 | 378 | $copy_from_path = $this->_getRelativeLogPath($path_data, 'copyfrom-path', $repository_path); |
| 379 | 379 | $to_colorize .= PHP_EOL . ' (from ' . $copy_from_path . ':' . $copy_from_rev . ')'; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - if ( $color_format ) { |
|
| 382 | + if ($color_format) { |
|
| 383 | 383 | $to_colorize = '<' . $color_format . '>' . $to_colorize . '</>'; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $table->addRow(new TableSeparator()); |
| 390 | 390 | $table->addRow(array(new TableCell($details, array('colspan' => 5)))); |
| 391 | 391 | |
| 392 | - if ( $revision != $last_revision ) { |
|
| 392 | + if ($revision != $last_revision) { |
|
| 393 | 393 | $table->addRow(new TableSeparator()); |
| 394 | 394 | } |
| 395 | 395 | } |
@@ -411,13 +411,13 @@ discard block |
||
| 411 | 411 | { |
| 412 | 412 | $summary = array('added' => 0, 'changed' => 0, 'removed' => 0); |
| 413 | 413 | |
| 414 | - foreach ( $revision_paths as $path_data ) { |
|
| 414 | + foreach ($revision_paths as $path_data) { |
|
| 415 | 415 | $path_action = $path_data['action']; |
| 416 | 416 | |
| 417 | - if ( $path_action == 'A' ) { |
|
| 417 | + if ($path_action == 'A') { |
|
| 418 | 418 | $summary['added']++; |
| 419 | 419 | } |
| 420 | - elseif ( $path_action == 'D' ) { |
|
| 420 | + elseif ($path_action == 'D') { |
|
| 421 | 421 | $summary['removed']++; |
| 422 | 422 | } |
| 423 | 423 | else { |
@@ -425,11 +425,11 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - if ( $summary['added'] ) { |
|
| 428 | + if ($summary['added']) { |
|
| 429 | 429 | $summary['added'] = '<fg=green>+' . $summary['added'] . '</>'; |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - if ( $summary['removed'] ) { |
|
| 432 | + if ($summary['removed']) { |
|
| 433 | 433 | $summary['removed'] = '<fg=red>-' . $summary['removed'] . '</>'; |
| 434 | 434 | } |
| 435 | 435 | |
@@ -446,15 +446,15 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | protected function getMergeConflictPrediction(array $revision_paths, array $merge_conflict_regexps) |
| 448 | 448 | { |
| 449 | - if ( !$merge_conflict_regexps ) { |
|
| 449 | + if (!$merge_conflict_regexps) { |
|
| 450 | 450 | return array(); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | $conflict_paths = array(); |
| 454 | 454 | |
| 455 | - foreach ( $revision_paths as $revision_path ) { |
|
| 456 | - foreach ( $merge_conflict_regexps as $merge_conflict_regexp ) { |
|
| 457 | - if ( preg_match($merge_conflict_regexp, $revision_path['path']) ) { |
|
| 455 | + foreach ($revision_paths as $revision_path) { |
|
| 456 | + foreach ($merge_conflict_regexps as $merge_conflict_regexp) { |
|
| 457 | + if (preg_match($merge_conflict_regexp, $revision_path['path'])) { |
|
| 458 | 458 | $conflict_paths[] = $revision_path['path']; |
| 459 | 459 | } |
| 460 | 460 | } |
@@ -486,13 +486,13 @@ discard block |
||
| 486 | 486 | { |
| 487 | 487 | $ret = $path_data[$path_key]; |
| 488 | 488 | |
| 489 | - if ( $path_data['kind'] == 'dir' ) { |
|
| 489 | + if ($path_data['kind'] == 'dir') { |
|
| 490 | 490 | $ret .= '/'; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | $ret = str_replace($repository_path, '', $ret); |
| 494 | 494 | |
| 495 | - if ( $ret === '' ) { |
|
| 495 | + if ($ret === '') { |
|
| 496 | 496 | $ret = '.'; |
| 497 | 497 | } |
| 498 | 498 | |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | { |
| 509 | 509 | $wc_path = $this->getWorkingCopyPath(); |
| 510 | 510 | |
| 511 | - if ( !$this->repositoryConnector->isUrl($wc_path) ) { |
|
| 511 | + if (!$this->repositoryConnector->isUrl($wc_path)) { |
|
| 512 | 512 | return $this->repositoryConnector->getWorkingCopyUrl($wc_path); |
| 513 | 513 | } |
| 514 | 514 | |
@@ -174,8 +174,7 @@ discard block |
||
| 174 | 174 | $revisions = $this->_revisionListParser->expandRanges($revisions); |
| 175 | 175 | $revisions_by_path = array_intersect($revisions_by_path, $revisions); |
| 176 | 176 | $missing_revisions = array_diff($revisions, $revisions_by_path); |
| 177 | - } |
|
| 178 | - elseif ( $bugs ) { |
|
| 177 | + } elseif ( $bugs ) { |
|
| 179 | 178 | // Only show bug-related revisions on given path. The $missing_revisions is always empty. |
| 180 | 179 | $revisions_from_bugs = $revision_log->find('bugs', $bugs); |
| 181 | 180 | $revisions_by_path = array_intersect($revisions_by_path, $revisions_from_bugs); |
@@ -197,15 +196,13 @@ discard block |
||
| 197 | 196 | |
| 198 | 197 | if ( $this->io->getOption('merges') ) { |
| 199 | 198 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', 'all_merges')); |
| 200 | - } |
|
| 201 | - elseif ( $this->io->getOption('no-merges') ) { |
|
| 199 | + } elseif ( $this->io->getOption('no-merges') ) { |
|
| 202 | 200 | $revisions_by_path = array_diff($revisions_by_path, $revision_log->find('merges', 'all_merges')); |
| 203 | 201 | } |
| 204 | 202 | |
| 205 | 203 | if ( $this->io->getOption('merged') ) { |
| 206 | 204 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', 'all_merged')); |
| 207 | - } |
|
| 208 | - elseif ( $this->io->getOption('not-merged') ) { |
|
| 205 | + } elseif ( $this->io->getOption('not-merged') ) { |
|
| 209 | 206 | $revisions_by_path = array_diff($revisions_by_path, $revision_log->find('merges', 'all_merged')); |
| 210 | 207 | } |
| 211 | 208 | |
@@ -213,8 +210,7 @@ discard block |
||
| 213 | 210 | throw new CommandException( |
| 214 | 211 | 'No information about ' . implode(', ', $missing_revisions) . ' revision(-s).' |
| 215 | 212 | ); |
| 216 | - } |
|
| 217 | - elseif ( !$revisions_by_path ) { |
|
| 213 | + } elseif ( !$revisions_by_path ) { |
|
| 218 | 214 | throw new CommandException('No matching revisions found.'); |
| 219 | 215 | } |
| 220 | 216 | |
@@ -223,8 +219,7 @@ discard block |
||
| 223 | 219 | if ( $bugs || $revisions ) { |
| 224 | 220 | // Don't limit revisions, when provided explicitly by user. |
| 225 | 221 | $revisions_by_path_with_limit = $revisions_by_path; |
| 226 | - } |
|
| 227 | - else { |
|
| 222 | + } else { |
|
| 228 | 223 | // Apply limit only, when no explicit bugs/revisions are set. |
| 229 | 224 | $revisions_by_path_with_limit = array_slice($revisions_by_path, 0, $this->getLimit()); |
| 230 | 225 | } |
@@ -339,8 +334,7 @@ discard block |
||
| 339 | 334 | $merge_conflict_regexps |
| 340 | 335 | ); |
| 341 | 336 | $row[] = $merge_conflict_predication ? '<error>' . count($merge_conflict_predication) . '</error>' : ''; |
| 342 | - } |
|
| 343 | - else { |
|
| 337 | + } else { |
|
| 344 | 338 | $merge_conflict_predication = array(); |
| 345 | 339 | } |
| 346 | 340 | |
@@ -363,11 +357,9 @@ discard block |
||
| 363 | 357 | |
| 364 | 358 | if ( $path_action == 'A' ) { |
| 365 | 359 | $color_format = 'fg=green'; |
| 366 | - } |
|
| 367 | - elseif ( $path_action == 'D' ) { |
|
| 360 | + } elseif ( $path_action == 'D' ) { |
|
| 368 | 361 | $color_format = 'fg=red'; |
| 369 | - } |
|
| 370 | - else { |
|
| 362 | + } else { |
|
| 371 | 363 | $color_format = in_array($path_data['path'], $merge_conflict_predication) ? 'error' : ''; |
| 372 | 364 | } |
| 373 | 365 | |
@@ -416,11 +408,9 @@ discard block |
||
| 416 | 408 | |
| 417 | 409 | if ( $path_action == 'A' ) { |
| 418 | 410 | $summary['added']++; |
| 419 | - } |
|
| 420 | - elseif ( $path_action == 'D' ) { |
|
| 411 | + } elseif ( $path_action == 'D' ) { |
|
| 421 | 412 | $summary['removed']++; |
| 422 | - } |
|
| 423 | - else { |
|
| 413 | + } else { |
|
| 424 | 414 | $summary['changed']++; |
| 425 | 415 | } |
| 426 | 416 | } |
@@ -50,13 +50,13 @@ |
||
| 50 | 50 | $wc_path = $this->getWorkingCopyPath(); |
| 51 | 51 | $conflicts = $this->repositoryConnector->getWorkingCopyConflicts($wc_path); |
| 52 | 52 | |
| 53 | - if ( !$conflicts ) { |
|
| 53 | + if (!$conflicts) { |
|
| 54 | 54 | throw new CommandException('No conflicts detected.'); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $resolve_path = $this->getResolvePath($conflicts); |
| 58 | 58 | |
| 59 | - if ( is_dir($resolve_path) ) { |
|
| 59 | + if (is_dir($resolve_path)) { |
|
| 60 | 60 | throw new CommandException('Interactive tree conflict resolution is not supported.'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function __construct($name, $default, $scope_bit = null) |
| 68 | 68 | { |
| 69 | - if ( !isset($scope_bit) ) { |
|
| 69 | + if (!isset($scope_bit)) { |
|
| 70 | 70 | $scope_bit = self::SCOPE_WORKING_COPY; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Always add global scope. |
| 74 | 74 | $this->_scope = $scope_bit | self::SCOPE_GLOBAL; |
| 75 | 75 | |
| 76 | - if ( !in_array($scope_bit, array(self::SCOPE_WORKING_COPY, self::SCOPE_GLOBAL)) ) { |
|
| 76 | + if (!in_array($scope_bit, array(self::SCOPE_WORKING_COPY, self::SCOPE_GLOBAL))) { |
|
| 77 | 77 | throw new \InvalidArgumentException('The $scope must be either "working copy" or "global".'); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $this->assertUsage(__METHOD__, $scope_bit); |
| 140 | 140 | |
| 141 | - if ( isset($scope_bit) ) { |
|
| 141 | + if (isset($scope_bit)) { |
|
| 142 | 142 | $value = $this->_editor->get( |
| 143 | 143 | $this->_getScopedName(__METHOD__, $scope_bit), |
| 144 | 144 | $this->_defaultValue |
@@ -147,19 +147,19 @@ discard block |
||
| 147 | 147 | else { |
| 148 | 148 | $value = null; |
| 149 | 149 | |
| 150 | - if ( $this->isWithinScope(self::SCOPE_WORKING_COPY) ) { |
|
| 150 | + if ($this->isWithinScope(self::SCOPE_WORKING_COPY)) { |
|
| 151 | 151 | $value = $this->_editor->get( |
| 152 | 152 | $this->_getScopedName(__METHOD__, self::SCOPE_WORKING_COPY) |
| 153 | 153 | ); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if ( $value === null ) { |
|
| 156 | + if ($value === null) { |
|
| 157 | 157 | $value = $this->_editor->get( |
| 158 | 158 | $this->_getScopedName(__METHOD__, self::SCOPE_GLOBAL) |
| 159 | 159 | ); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if ( $value === null ) { |
|
| 162 | + if ($value === null) { |
|
| 163 | 163 | $value = $this->_defaultValue; |
| 164 | 164 | } |
| 165 | 165 | } |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | $this->assertUsage(__METHOD__, $scope_bit); |
| 182 | 182 | |
| 183 | - if ( $value !== null ) { |
|
| 183 | + if ($value !== null) { |
|
| 184 | 184 | $value = $this->normalizeValue($value); |
| 185 | 185 | $this->validate($value); |
| 186 | 186 | $value = $this->convertToStorageFormat($value); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - if ( !isset($scope_bit) ) { |
|
| 190 | - if ( $this->isWithinScope(self::SCOPE_WORKING_COPY) ) { |
|
| 189 | + if (!isset($scope_bit)) { |
|
| 190 | + if ($this->isWithinScope(self::SCOPE_WORKING_COPY)) { |
|
| 191 | 191 | $scope_bit = self::SCOPE_WORKING_COPY; |
| 192 | 192 | } |
| 193 | 193 | else { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | // Don't store inherited value. |
| 199 | - if ( $value === $this->_getInheritedValue(__METHOD__, $scope_bit) ) { |
|
| 199 | + if ($value === $this->_getInheritedValue(__METHOD__, $scope_bit)) { |
|
| 200 | 200 | $value = null; |
| 201 | 201 | } |
| 202 | 202 | |
@@ -215,11 +215,11 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function assertUsage($caller_method, $scope_bit = null) |
| 217 | 217 | { |
| 218 | - if ( !isset($this->_editor) ) { |
|
| 218 | + if (!isset($this->_editor)) { |
|
| 219 | 219 | throw new \LogicException('Please use setEditor() before calling ' . $caller_method . '().'); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if ( isset($scope_bit) && !$this->isWithinScope($scope_bit) ) { |
|
| 222 | + if (isset($scope_bit) && !$this->isWithinScope($scope_bit)) { |
|
| 223 | 223 | $error_msg = 'The usage of "%s" scope bit for "%s" config setting is forbidden.'; |
| 224 | 224 | throw new \InvalidArgumentException(sprintf($error_msg, $scope_bit, $this->getName())); |
| 225 | 225 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | private function _getInheritedValue($caller_method, $scope_bit) |
| 237 | 237 | { |
| 238 | - if ( $scope_bit === self::SCOPE_WORKING_COPY ) { |
|
| 238 | + if ($scope_bit === self::SCOPE_WORKING_COPY) { |
|
| 239 | 239 | return $this->_editor->get($this->_getScopedName($caller_method, self::SCOPE_GLOBAL), $this->_defaultValue); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -253,11 +253,11 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | private function _getScopedName($caller_method, $scope) |
| 255 | 255 | { |
| 256 | - if ( $scope === self::SCOPE_GLOBAL ) { |
|
| 256 | + if ($scope === self::SCOPE_GLOBAL) { |
|
| 257 | 257 | return 'global-settings.' . $this->_name; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if ( !$this->_workingCopyUrl ) { |
|
| 260 | + if (!$this->_workingCopyUrl) { |
|
| 261 | 261 | throw new \LogicException( |
| 262 | 262 | 'Please call setWorkingCopyUrl() prior to calling ' . $caller_method . '() method.' |
| 263 | 263 | ); |
@@ -143,8 +143,7 @@ discard block |
||
| 143 | 143 | $this->_getScopedName(__METHOD__, $scope_bit), |
| 144 | 144 | $this->_defaultValue |
| 145 | 145 | ); |
| 146 | - } |
|
| 147 | - else { |
|
| 146 | + } else { |
|
| 148 | 147 | $value = null; |
| 149 | 148 | |
| 150 | 149 | if ( $this->isWithinScope(self::SCOPE_WORKING_COPY) ) { |
@@ -189,8 +188,7 @@ discard block |
||
| 189 | 188 | if ( !isset($scope_bit) ) { |
| 190 | 189 | if ( $this->isWithinScope(self::SCOPE_WORKING_COPY) ) { |
| 191 | 190 | $scope_bit = self::SCOPE_WORKING_COPY; |
| 192 | - } |
|
| 193 | - else { |
|
| 191 | + } else { |
|
| 194 | 192 | $scope_bit = self::SCOPE_GLOBAL; |
| 195 | 193 | } |
| 196 | 194 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | protected function normalizeValue($value) |
| 25 | 25 | { |
| 26 | - if ( !is_array($value) ) { |
|
| 26 | + if (!is_array($value)) { |
|
| 27 | 27 | $value = strlen($value) ? explode(PHP_EOL, $value) : array(); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | protected function validate($value) |
| 38 | 38 | { |
| 39 | - if ( !is_numeric($value) ) { |
|
| 39 | + if (!is_numeric($value)) { |
|
| 40 | 40 | throw new \InvalidArgumentException( |
| 41 | 41 | 'The "' . $this->getName() . '" config setting value must be an integer.' |
| 42 | 42 | ); |
@@ -26,8 +26,8 @@ |
||
| 26 | 26 | { |
| 27 | 27 | parent::validate($value); |
| 28 | 28 | |
| 29 | - foreach ( $value as $path ) { |
|
| 30 | - if ( !file_exists($path) || !is_dir($path) ) { |
|
| 29 | + foreach ($value as $path) { |
|
| 30 | + if (!file_exists($path) || !is_dir($path)) { |
|
| 31 | 31 | throw new \InvalidArgumentException('The "' . $path . '" path doesn\'t exist or not a directory.'); |
| 32 | 32 | } |
| 33 | 33 | } |