@@ -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 | } |
@@ -26,8 +26,8 @@ |
||
26 | 26 | { |
27 | 27 | parent::validate($value); |
28 | 28 | |
29 | - foreach ( $value as $regexp ) { |
|
30 | - if ( @preg_match($regexp, 'test') === false ) { |
|
29 | + foreach ($value as $regexp) { |
|
30 | + if (@preg_match($regexp, 'test') === false) { |
|
31 | 31 | throw new \InvalidArgumentException('The "' . $regexp . '" is not a valid regular expression.'); |
32 | 32 | } |
33 | 33 | } |
@@ -48,7 +48,7 @@ |
||
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 | ); |
@@ -41,11 +41,11 @@ discard block |
||
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 |
||
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 | } |
@@ -53,15 +53,15 @@ |
||
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 |
@@ -46,26 +46,26 @@ |
||
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 |
@@ -50,7 +50,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |