Completed
Branch master (8fc554)
by Alexander
06:05
created
src/SVNBuddy/Config/StringConfigSetting.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 	 */
49 49
 	protected function validate($value)
50 50
 	{
51
-		if ( !is_string($value) ) {
51
+		if (!is_string($value)) {
52 52
 			throw new \InvalidArgumentException(
53 53
 				'The "' . $this->getName() . '" config setting value must be a string.'
54 54
 			);
Please login to merge, or discard this patch.
src/SVNBuddy/Container.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 			'repository-connector.password' => '',
42 42
 		);
43 43
 
44
-		$this['process_factory'] = function () {
44
+		$this['process_factory'] = function() {
45 45
 			return new ProcessFactory();
46 46
 		};
47 47
 
48
-		$this['merge_source_detector'] = function () {
48
+		$this['merge_source_detector'] = function() {
49 49
 			$merge_source_detector = new MergeSourceDetectorAggregator(0);
50 50
 			$merge_source_detector->add(new ClassicMergeSourceDetector(0));
51 51
 			$merge_source_detector->add(new InPortalMergeSourceDetector(50));
@@ -53,27 +53,27 @@  discard block
 block discarded – undo
53 53
 			return $merge_source_detector;
54 54
 		};
55 55
 
56
-		$this['cache_manager'] = function ($c) {
56
+		$this['cache_manager'] = function($c) {
57 57
 			return new CacheManager($c['working_directory']);
58 58
 		};
59 59
 
60
-		$this['revision_log_factory'] = function ($c) {
60
+		$this['revision_log_factory'] = function($c) {
61 61
 			return new RevisionLogFactory($c['repository_connector'], $c['cache_manager'], $c['io']);
62 62
 		};
63 63
 
64
-		$this['revision_list_parser'] = function () {
64
+		$this['revision_list_parser'] = function() {
65 65
 			return new RevisionListParser();
66 66
 		};
67 67
 
68
-		$this['repository_connector'] = function ($c) {
68
+		$this['repository_connector'] = function($c) {
69 69
 			return new Connector($c['config_editor'], $c['process_factory'], $c['io'], $c['cache_manager']);
70 70
 		};
71 71
 
72
-		$this['date_helper'] = function () {
72
+		$this['date_helper'] = function() {
73 73
 			return new DateHelper();
74 74
 		};
75 75
 
76
-		$this['editor'] = function () {
76
+		$this['editor'] = function() {
77 77
 			return new InteractiveEditor();
78 78
 		};
79 79
 	}
Please login to merge, or discard this patch.
src/SVNBuddy/Exception/RepositoryCommandException.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,15 +53,15 @@
 block discarded – undo
53 53
 
54 54
 		$lines = array_filter(explode(PHP_EOL, $error_output));
55 55
 
56
-		foreach ( $lines as $line ) {
57
-			if ( preg_match('/^svn\: E([\d]+)\: (.*)$/', $line, $regs) ) {
56
+		foreach ($lines as $line) {
57
+			if (preg_match('/^svn\: E([\d]+)\: (.*)$/', $line, $regs)) {
58 58
 				// SVN 1.7+.
59 59
 				$error_code = $regs[1];
60 60
 				$error_message .= PHP_EOL . $regs[2];
61 61
 			}
62
-			elseif ( preg_match('/^svn\: (.*)$/', $line, $regs) ) {
62
+			elseif (preg_match('/^svn\: (.*)$/', $line, $regs)) {
63 63
 				// SVN 1.6-.
64
-				if ( preg_match('/^\'(.*)\' is not a working copy$/', $regs[1]) ) {
64
+				if (preg_match('/^\'(.*)\' is not a working copy$/', $regs[1])) {
65 65
 					$error_code = self::SVN_ERR_WC_NOT_WORKING_COPY;
66 66
 				}
67 67
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,16 +58,14 @@
 block discarded – undo
58 58
 				// SVN 1.7+.
59 59
 				$error_code = $regs[1];
60 60
 				$error_message .= PHP_EOL . $regs[2];
61
-			}
62
-			elseif ( preg_match('/^svn\: (.*)$/', $line, $regs) ) {
61
+			} elseif ( preg_match('/^svn\: (.*)$/', $line, $regs) ) {
63 62
 				// SVN 1.6-.
64 63
 				if ( preg_match('/^\'(.*)\' is not a working copy$/', $regs[1]) ) {
65 64
 					$error_code = self::SVN_ERR_WC_NOT_WORKING_COPY;
66 65
 				}
67 66
 
68 67
 				$error_message .= PHP_EOL . $regs[1];
69
-			}
70
-			else {
68
+			} else {
71 69
 				$error_message .= ' ' . $line;
72 70
 			}
73 71
 		}
Please login to merge, or discard this patch.
src/SVNBuddy/Helper/DateHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,26 +46,26 @@
 block discarded – undo
46 46
 		);
47 47
 
48 48
 		// @codeCoverageIgnoreStart
49
-		if ( !isset($to_date) ) {
49
+		if (!isset($to_date)) {
50 50
 			$to_date = time();
51 51
 		}
52 52
 		// @codeCoverageIgnoreEnd
53 53
 
54 54
 		$diff = abs($to_date - $from_date);
55 55
 
56
-		if ( $diff == 0 ) {
56
+		if ($diff == 0) {
57 57
 			return 'now';
58 58
 		}
59 59
 
60 60
 		$current_level = 1;
61 61
 		$result = array();
62 62
 
63
-		foreach ( $blocks as $block ) {
64
-			if ( $current_level > $max_levels ) {
63
+		foreach ($blocks as $block) {
64
+			if ($current_level > $max_levels) {
65 65
 				break;
66 66
 			}
67 67
 
68
-			if ( $diff / $block['amount'] >= 1 ) {
68
+			if ($diff / $block['amount'] >= 1) {
69 69
 				$amount = floor($diff / $block['amount']);
70 70
 				$plural = $amount > 1 ? 's' : '';
71 71
 
Please login to merge, or discard this patch.
src/SVNBuddy/InteractiveEditor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function getDocumentName()
52 52
 	{
53
-		if ( !strlen($this->_documentName) ) {
53
+		if (!strlen($this->_documentName)) {
54 54
 			return 'untitled';
55 55
 		}
56 56
 
@@ -91,24 +91,24 @@  discard block
 block discarded – undo
91 91
 	{
92 92
 		$tmp_file = tempnam(sys_get_temp_dir(), $this->getDocumentName() . '_');
93 93
 
94
-		if ( $tmp_file === false ) {
94
+		if ($tmp_file === false) {
95 95
 			throw new \RuntimeException('Unable to create temporary file.');
96 96
 		}
97 97
 
98
-		if ( file_put_contents($tmp_file, $this->getContent()) === false ) {
98
+		if (file_put_contents($tmp_file, $this->getContent()) === false) {
99 99
 			throw new \RuntimeException('Unable to write content to temporary file.');
100 100
 		}
101 101
 
102 102
 		$exit_code = $this->_invokeEditor($this->_getEditor(), $tmp_file);
103 103
 
104
-		if ( $exit_code ) {
104
+		if ($exit_code) {
105 105
 			unlink($tmp_file);
106 106
 			throw new \RuntimeException('Editor exited with an error code (#' . $exit_code . ').');
107 107
 		}
108 108
 
109 109
 		$new_content = file_get_contents($tmp_file);
110 110
 
111
-		if ( $new_content === false ) {
111
+		if ($new_content === false) {
112 112
 			throw new \RuntimeException('Unable to read content from temporary file.');
113 113
 		}
114 114
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
 		$proc = proc_open($command, $spec, $pipes);
139 139
 
140
-		if ( !is_resource($proc) ) {
140
+		if (!is_resource($proc)) {
141 141
 			throw new \RuntimeException('Failed to run: ' . $command);
142 142
 		}
143 143
 
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
 	{
157 157
 		$editor = getenv('EDITOR');
158 158
 
159
-		if ( $editor ) {
159
+		if ($editor) {
160 160
 			return $editor;
161 161
 		}
162 162
 
163 163
 		// Look for `editor` in PATH, some systems provide an editor which is linked to something sensible.
164
-		if ( $this->_fileExistsInPath('editor') ) {
164
+		if ($this->_fileExistsInPath('editor')) {
165 165
 			return 'editor';
166 166
 		}
167 167
 
168
-		if ( $this->_fileExistsInPath('nano') ) {
168
+		if ($this->_fileExistsInPath('nano')) {
169 169
 			return 'nano';
170 170
 		}
171 171
 
Please login to merge, or discard this patch.
src/SVNBuddy/MergeSourceDetector/ClassicMergeSourceDetector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	public function detect($repository_url)
25 25
 	{
26 26
 		// Merging "trunk" into "stable" or other tag.
27
-		if ( preg_match('#^(.*)/tags/(.*)$#', $repository_url, $regs) ) {
27
+		if (preg_match('#^(.*)/tags/(.*)$#', $repository_url, $regs)) {
28 28
 			return $regs[1] . '/trunk';
29 29
 		}
30 30
 
Please login to merge, or discard this patch.
src/SVNBuddy/MergeSourceDetector/InPortalMergeSourceDetector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/SVNBuddy/MergeSourceDetector/MergeSourceDetectorAggregator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
src/SVNBuddy/Repository/Connector/Command.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -110,23 +110,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,8 +168,7 @@
 block discarded – undo
168 168
 					PHP_EOL . '<fg=white;bg=magenta>[svn, ' . round($runtime, 2) . 's]: ' . $command_line . '</>'
169 169
 				);
170 170
 			}
171
-		}
172
-		catch ( ProcessFailedException $e ) {
171
+		} catch ( ProcessFailedException $e ) {
173 172
 			$process = $e->getProcess();
174 173
 
175 174
 			throw new RepositoryCommandException(
Please login to merge, or discard this patch.