@@ -163,8 +163,7 @@ |
||
163 | 163 | if($section->isDefault()) |
164 | 164 | { |
165 | 165 | $result = array_merge($result, $section->toArray()); |
166 | - } |
|
167 | - else |
|
166 | + } else |
|
168 | 167 | { |
169 | 168 | $result[$section->getName()] = $section->toArray(); |
170 | 169 | } |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | { |
36 | 36 | $section = $this->addSection(self::SECTION_DEFAULT); |
37 | 37 | |
38 | - if(empty($iniString)) { |
|
38 | + if (empty($iniString)) { |
|
39 | 39 | return; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $eol = ConvertHelper::detectEOLCharacter($iniString); |
43 | - if($eol !== null) { |
|
43 | + if ($eol !== null) { |
|
44 | 44 | $this->eol = $eol->getCharacter(); |
45 | 45 | } |
46 | 46 | |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | |
49 | 49 | $total = count($lines); |
50 | 50 | |
51 | - for($i=0; $i < $total; $i++) |
|
51 | + for ($i = 0; $i < $total; $i++) |
|
52 | 52 | { |
53 | 53 | $line = new IniHelper_Line($lines[$i], $i); |
54 | 54 | |
55 | - if($line->isSection()) { |
|
55 | + if ($line->isSection()) { |
|
56 | 56 | $section = $this->addSection($line->getSectionName()); |
57 | 57 | } |
58 | 58 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $iniPath = FileHelper::requireFileExists($iniPath); |
83 | 83 | |
84 | 84 | $content = file_get_contents($iniPath); |
85 | - if($content !== false) { |
|
85 | + if ($content !== false) { |
|
86 | 86 | return self::createFromString($content); |
87 | 87 | } |
88 | 88 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function addSection(string $name) : IniHelper_Section |
129 | 129 | { |
130 | - if(!isset($this->sections[$name])) { |
|
130 | + if (!isset($this->sections[$name])) { |
|
131 | 131 | $this->sections[$name] = new IniHelper_Section($this, $name); |
132 | 132 | } |
133 | 133 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function getSection(string $name) : ?IniHelper_Section |
144 | 144 | { |
145 | - if(isset($this->sections[$name])) { |
|
145 | + if (isset($this->sections[$name])) { |
|
146 | 146 | return $this->sections[$name]; |
147 | 147 | } |
148 | 148 | |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | { |
159 | 159 | $result = array(); |
160 | 160 | |
161 | - foreach($this->sections as $section) |
|
161 | + foreach ($this->sections as $section) |
|
162 | 162 | { |
163 | - if($section->isDefault()) |
|
163 | + if ($section->isDefault()) |
|
164 | 164 | { |
165 | 165 | $result = array_merge($result, $section->toArray()); |
166 | 166 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | { |
201 | 201 | $parts = array(); |
202 | 202 | |
203 | - foreach($this->sections as $section) |
|
203 | + foreach ($this->sections as $section) |
|
204 | 204 | { |
205 | 205 | $parts[] = $section->toString(); |
206 | 206 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function sectionExists(string $name) : bool |
245 | 245 | { |
246 | - foreach($this->sections as $section) { |
|
247 | - if($section->getName() === $name) { |
|
246 | + foreach ($this->sections as $section) { |
|
247 | + if ($section->getName() === $name) { |
|
248 | 248 | return true; |
249 | 249 | } |
250 | 250 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | { |
274 | 274 | $path = $this->parsePath($path); |
275 | 275 | |
276 | - if(!$this->sectionExists($path['section'])) { |
|
276 | + if (!$this->sectionExists($path['section'])) { |
|
277 | 277 | return array(); |
278 | 278 | } |
279 | 279 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | { |
285 | 285 | $path = explode($this->pathSeparator, $path); |
286 | 286 | |
287 | - if(count($path) === 1) |
|
287 | + if (count($path) === 1) |
|
288 | 288 | { |
289 | 289 | return array( |
290 | 290 | 'section' => self::SECTION_DEFAULT, |
@@ -159,8 +159,7 @@ discard block |
||
159 | 159 | if($hash === true) |
160 | 160 | { |
161 | 161 | $hash = 'true'; |
162 | - } |
|
163 | - else if($hash === false) |
|
162 | + } else if($hash === false) |
|
164 | 163 | { |
165 | 164 | $hash = 'false'; |
166 | 165 | } |
@@ -184,8 +183,7 @@ discard block |
||
184 | 183 | if($string === false) |
185 | 184 | { |
186 | 185 | $string = ''; |
187 | - } |
|
188 | - else if($quoteStyle === self::QUOTE_STYLE_SINGLE) |
|
186 | + } else if($quoteStyle === self::QUOTE_STYLE_SINGLE) |
|
189 | 187 | { |
190 | 188 | $string = mb_substr($string, 1, mb_strlen($string)-2); |
191 | 189 | $string = "'".str_replace("'", "\'", $string)."'"; |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | $quoteStyle = array_shift($params); |
96 | 96 | $method = array_shift($params); |
97 | 97 | |
98 | - $call = $method . '('; |
|
98 | + $call = $method.'('; |
|
99 | 99 | |
100 | 100 | $total = count($params); |
101 | - if($total > 0) { |
|
102 | - for($i=0; $i < $total; $i++) |
|
101 | + if ($total > 0) { |
|
102 | + for ($i = 0; $i < $total; $i++) |
|
103 | 103 | { |
104 | 104 | $call .= self::phpVariable2JS($params[$i], $quoteStyle); |
105 | - if($i < ($total-1)) { |
|
105 | + if ($i < ($total - 1)) { |
|
106 | 106 | $call .= ','; |
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | - return $call . ');'; |
|
111 | + return $call.');'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public static function buildVariable(string $varName, $varValue) : string |
134 | 134 | { |
135 | - return $varName . "=" . self::phpVariable2JS($varValue) . ';'; |
|
135 | + return $varName."=".self::phpVariable2JS($varValue).';'; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param int $quoteStyle The quote style to use for strings |
145 | 145 | * @return string |
146 | 146 | */ |
147 | - public static function phpVariable2JS($variable, int $quoteStyle=self::QUOTE_STYLE_DOUBLE) : string |
|
147 | + public static function phpVariable2JS($variable, int $quoteStyle = self::QUOTE_STYLE_DOUBLE) : string |
|
148 | 148 | { |
149 | 149 | // after much profiling, this variant of the method offers |
150 | 150 | // the best performance. Repeat scalar values are cached |
@@ -152,22 +152,22 @@ discard block |
||
152 | 152 | |
153 | 153 | $type = gettype($variable); |
154 | 154 | $hash = null; |
155 | - if(is_scalar($variable) === true) |
|
155 | + if (is_scalar($variable) === true) |
|
156 | 156 | { |
157 | 157 | $hash = $variable; |
158 | 158 | |
159 | - if($hash === true) |
|
159 | + if ($hash === true) |
|
160 | 160 | { |
161 | 161 | $hash = 'true'; |
162 | 162 | } |
163 | - else if($hash === false) |
|
163 | + else if ($hash === false) |
|
164 | 164 | { |
165 | 165 | $hash = 'false'; |
166 | 166 | } |
167 | 167 | |
168 | 168 | $hash .= '-'.$quoteStyle.'-'.$type; |
169 | 169 | |
170 | - if(isset(self::$variableCache[$hash])) { |
|
170 | + if (isset(self::$variableCache[$hash])) { |
|
171 | 171 | return self::$variableCache[$hash]; |
172 | 172 | } |
173 | 173 | } |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | $result = 'null'; |
176 | 176 | |
177 | 177 | // one gettype call is better than a strict if-else. |
178 | - switch($type) |
|
178 | + switch ($type) |
|
179 | 179 | { |
180 | 180 | case 'double': |
181 | 181 | case 'string': |
182 | 182 | $string = json_encode($variable); |
183 | 183 | |
184 | - if($string === false) |
|
184 | + if ($string === false) |
|
185 | 185 | { |
186 | 186 | $string = ''; |
187 | 187 | } |
188 | - else if($quoteStyle === self::QUOTE_STYLE_SINGLE) |
|
188 | + else if ($quoteStyle === self::QUOTE_STYLE_SINGLE) |
|
189 | 189 | { |
190 | - $string = mb_substr($string, 1, mb_strlen($string)-2); |
|
190 | + $string = mb_substr($string, 1, mb_strlen($string) - 2); |
|
191 | 191 | $string = "'".str_replace("'", "\'", $string)."'"; |
192 | 192 | } |
193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | break; |
196 | 196 | |
197 | 197 | case 'boolean': |
198 | - if($variable === true) { |
|
198 | + if ($variable === true) { |
|
199 | 199 | $result = 'true'; |
200 | 200 | } else { |
201 | 201 | $result = 'false'; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | // cache cacheable values |
216 | - if($hash !== null) |
|
216 | + if ($hash !== null) |
|
217 | 217 | { |
218 | 218 | self::$variableCache[$hash] = $result; |
219 | 219 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | self::$elementCounter++; |
247 | 247 | |
248 | - return self::$idPrefix . self::$elementCounter; |
|
248 | + return self::$idPrefix.self::$elementCounter; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @see JSHelper::JS_REGEX_OBJECT |
320 | 320 | * @see JSHelper::JS_REGEX_JSON |
321 | 321 | */ |
322 | - public static function buildRegexStatement(string $regex, string $statementType=self::JS_REGEX_OBJECT) : string |
|
322 | + public static function buildRegexStatement(string $regex, string $statementType = self::JS_REGEX_OBJECT) : string |
|
323 | 323 | { |
324 | 324 | $regex = trim($regex); |
325 | 325 | $separator = substr($regex, 0, 1); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | array_shift($parts); |
328 | 328 | |
329 | 329 | $modifiers = array_pop($parts); |
330 | - if($modifiers == $separator) { |
|
330 | + if ($modifiers == $separator) { |
|
331 | 331 | $modifiers = ''; |
332 | 332 | } |
333 | 333 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | // convert the anchors that are not supported in js regexes |
344 | 344 | $format = str_replace(array('\\A', '\\Z', '\\z'), array('^', '$', ''), $format); |
345 | 345 | |
346 | - if($statementType==self::JS_REGEX_JSON) |
|
346 | + if ($statementType == self::JS_REGEX_JSON) |
|
347 | 347 | { |
348 | 348 | return ConvertHelper::var2json(array( |
349 | 349 | 'format' => $format, |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | )); |
352 | 352 | } |
353 | 353 | |
354 | - if(!empty($modifiers)) { |
|
354 | + if (!empty($modifiers)) { |
|
355 | 355 | return sprintf( |
356 | 356 | 'new RegExp(%s, %s)', |
357 | 357 | ConvertHelper::var2json($format), |
@@ -322,8 +322,7 @@ |
||
322 | 322 | if($this->current < 1) |
323 | 323 | { |
324 | 324 | $this->current = 1; |
325 | - } |
|
326 | - else if($this->current > $pages) |
|
325 | + } else if($this->current > $pages) |
|
327 | 326 | { |
328 | 327 | $this->current = $pages; |
329 | 328 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getNextPage() : int |
115 | 115 | { |
116 | - if($this->next === 0) { |
|
116 | + if ($this->next === 0) { |
|
117 | 117 | return $this->last; |
118 | 118 | } |
119 | 119 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function getPreviousPage() : int |
139 | 139 | { |
140 | - if($this->prev === 0) { |
|
140 | + if ($this->prev === 0) { |
|
141 | 141 | return 1; |
142 | 142 | } |
143 | 143 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // adjust the adjacent value if it exceeds the |
183 | 183 | // total amount of pages |
184 | 184 | $adjacentTotal = ($adjacent * 2) + 1; |
185 | - if($adjacentTotal > $this->last) |
|
185 | + if ($adjacentTotal > $this->last) |
|
186 | 186 | { |
187 | 187 | $adjacent = (int)floor($this->last / 2); |
188 | 188 | } |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | $back = 0; |
196 | 196 | $fwd = 0; |
197 | 197 | |
198 | - if($maxBack >= $adjacent) { |
|
198 | + if ($maxBack >= $adjacent) { |
|
199 | 199 | $back = $adjacent; |
200 | 200 | } else { |
201 | 201 | $back = $maxBack; |
202 | 202 | } |
203 | 203 | |
204 | - if($maxFwd >= $adjacent) { |
|
204 | + if ($maxFwd >= $adjacent) { |
|
205 | 205 | $fwd = $adjacent; |
206 | 206 | } else { |
207 | 207 | $fwd = $maxFwd; |
@@ -217,16 +217,16 @@ discard block |
||
217 | 217 | $fwd += $backDiff; |
218 | 218 | $back += $fwdDiff; |
219 | 219 | |
220 | - if($fwd > $maxFwd) { $fwd = $maxFwd; } |
|
221 | - if($back > $maxBack) { $back = $maxBack; } |
|
220 | + if ($fwd > $maxFwd) { $fwd = $maxFwd; } |
|
221 | + if ($back > $maxBack) { $back = $maxBack; } |
|
222 | 222 | |
223 | 223 | // calculate the first and last page in the list |
224 | 224 | $prev = $this->current - $back; |
225 | 225 | $next = $this->current + $fwd; |
226 | 226 | |
227 | 227 | // failsafe so we stay within the bounds |
228 | - if($prev < 1) { $prev = 1; } |
|
229 | - if($next > $this->last) { $next = $this->last; } |
|
228 | + if ($prev < 1) { $prev = 1; } |
|
229 | + if ($next > $this->last) { $next = $this->last; } |
|
230 | 230 | |
231 | 231 | // create and return the page numbers list |
232 | 232 | $numbers = range($prev, $next); |
@@ -319,11 +319,11 @@ discard block |
||
319 | 319 | { |
320 | 320 | $pages = (int)ceil($this->total / $this->perPage); |
321 | 321 | |
322 | - if($this->current < 1) |
|
322 | + if ($this->current < 1) |
|
323 | 323 | { |
324 | 324 | $this->current = 1; |
325 | 325 | } |
326 | - else if($this->current > $pages) |
|
326 | + else if ($this->current > $pages) |
|
327 | 327 | { |
328 | 328 | $this->current = $pages; |
329 | 329 | } |
@@ -331,19 +331,19 @@ discard block |
||
331 | 331 | $this->last = $pages; |
332 | 332 | |
333 | 333 | $nextPage = $this->current + 1; |
334 | - if($nextPage <= $pages) { |
|
334 | + if ($nextPage <= $pages) { |
|
335 | 335 | $this->next = $nextPage; |
336 | 336 | } |
337 | 337 | |
338 | 338 | $prevPage = $this->current - 1; |
339 | - if($prevPage > 0) { |
|
339 | + if ($prevPage > 0) { |
|
340 | 340 | $this->prev = $prevPage; |
341 | 341 | } |
342 | 342 | |
343 | 343 | $this->offsetStart = ($this->current - 1) * $this->perPage; |
344 | 344 | |
345 | 345 | $this->offsetEnd = $this->offsetStart + $this->perPage; |
346 | - if($this->offsetEnd > ($this->total - 1)) { |
|
346 | + if ($this->offsetEnd > ($this->total - 1)) { |
|
347 | 347 | $this->offsetEnd = ($this->total - 1); |
348 | 348 | } |
349 | 349 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | { |
66 | 66 | $this->isWindows = substr(PHP_OS, 0, 3) == 'WIN'; |
67 | 67 | |
68 | - if($this->isWindows) { |
|
68 | + if ($this->isWindows) { |
|
69 | 69 | $this->normalize['from'] = '/'; |
70 | 70 | $this->normalize['to'] = '\\'; |
71 | 71 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // |
81 | 81 | // NOTE: In case of symlinks, this resolves the symlink to its source (WIN/NIX) |
82 | 82 | $realPath = realpath($this->sourcePath); |
83 | - if(!is_dir($realPath)) { |
|
83 | + if (!is_dir($realPath)) { |
|
84 | 84 | throw new SVNHelper_Exception( |
85 | 85 | 'Local repository path does not exist', |
86 | 86 | sprintf( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $result = array(); |
99 | 99 | preg_match_all('%([^:]+):(.+)@(https|http|svn)://(.+)%sm', $repURL, $result, PREG_PATTERN_ORDER); |
100 | 100 | |
101 | - if(!isset($result[1]) || !isset($result[1][0])) { |
|
101 | + if (!isset($result[1]) || !isset($result[1][0])) { |
|
102 | 102 | throw new SVNHelper_Exception( |
103 | 103 | 'Invalid SVN repository URL', |
104 | 104 | 'The SVN URL must have the following format: [username:password@http://domain.com/path/to/rep].', |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | * @throws SVNHelper_Exception |
132 | 132 | * @return string |
133 | 133 | */ |
134 | - public function normalizePath($path, $relativize=false) |
|
134 | + public function normalizePath($path, $relativize = false) |
|
135 | 135 | { |
136 | - if(empty($path)) { |
|
136 | + if (empty($path)) { |
|
137 | 137 | return ''; |
138 | 138 | } |
139 | 139 | |
140 | - if($relativize) |
|
140 | + if ($relativize) |
|
141 | 141 | { |
142 | 142 | $path = $this->normalizePath($path); |
143 | 143 | |
144 | 144 | // path is absolute, and does not match the realpath or the source path? |
145 | - if(strstr($path, ':'.$this->getSlash()) && (!stristr($path, $this->path) && !stristr($path, $this->sourcePath))) { |
|
145 | + if (strstr($path, ':'.$this->getSlash()) && (!stristr($path, $this->path) && !stristr($path, $this->sourcePath))) { |
|
146 | 146 | throw new SVNHelper_Exception( |
147 | 147 | 'Cannot relativize path outside of repository', |
148 | 148 | sprintf( |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | */ |
224 | 224 | protected function filterPath($path) |
225 | 225 | { |
226 | - if(empty($path)) { |
|
226 | + if (empty($path)) { |
|
227 | 227 | return ''; |
228 | 228 | } |
229 | 229 | |
230 | 230 | $path = $this->getPath().'/'.$this->relativizePath($path); |
231 | 231 | |
232 | 232 | $real = realpath($path); |
233 | - if($real !== false) { |
|
233 | + if ($real !== false) { |
|
234 | 234 | return $real; |
235 | 235 | } |
236 | 236 | |
@@ -257,13 +257,13 @@ discard block |
||
257 | 257 | $key = $type.':'.$relativePath; |
258 | 258 | |
259 | 259 | $relativePath = $this->normalizePath($relativePath, true); |
260 | - if(isset($this->targets[$key])) { |
|
260 | + if (isset($this->targets[$key])) { |
|
261 | 261 | return $this->targets[$key]; |
262 | 262 | } |
263 | 263 | |
264 | 264 | $target = null; |
265 | 265 | |
266 | - switch($type) |
|
266 | + switch ($type) |
|
267 | 267 | { |
268 | 268 | case 'File': |
269 | 269 | $target = new SVNHelper_Target_File($this, $relativePath); |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | */ |
397 | 397 | public function addFolder($path) |
398 | 398 | { |
399 | - if(is_dir($path)) { |
|
399 | + if (is_dir($path)) { |
|
400 | 400 | return $this->getFolder($path); |
401 | 401 | } |
402 | 402 | |
@@ -404,12 +404,12 @@ discard block |
||
404 | 404 | $tokens = explode($this->getSlash(), $path); |
405 | 405 | |
406 | 406 | $target = $this->path; |
407 | - foreach($tokens as $folder) |
|
407 | + foreach ($tokens as $folder) |
|
408 | 408 | { |
409 | 409 | $target .= $this->getSlash().$folder; |
410 | - if(file_exists($target)) |
|
410 | + if (file_exists($target)) |
|
411 | 411 | { |
412 | - if(!is_dir($target)) { |
|
412 | + if (!is_dir($target)) { |
|
413 | 413 | throw new SVNHelper_Exception( |
414 | 414 | 'Target folder is a file', |
415 | 415 | sprintf( |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | continue; |
424 | 424 | } |
425 | 425 | |
426 | - if(!mkdir($target, 0777)) { |
|
426 | + if (!mkdir($target, 0777)) { |
|
427 | 427 | throw new SVNHelper_Exception( |
428 | 428 | 'Cannot create folder', |
429 | 429 | sprintf( |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | */ |
454 | 454 | public static function setLogCallback($callback) |
455 | 455 | { |
456 | - if(!is_callable($callback)) { |
|
456 | + if (!is_callable($callback)) { |
|
457 | 457 | throw new SVNHelper_Exception( |
458 | 458 | 'Not a valid logging callback', |
459 | 459 | 'The specified argument is not callable.', |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | |
467 | 467 | public static function log($message) |
468 | 468 | { |
469 | - if(isset(self::$logCallback)) { |
|
469 | + if (isset(self::$logCallback)) { |
|
470 | 470 | call_user_func(self::$logCallback, 'SVNHelper | '.$message); |
471 | 471 | } |
472 | 472 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | protected $logging = true; |
19 | 19 | |
20 | - public function __construct($message, $details=null, $code=null, $previous=null) |
|
20 | + public function __construct($message, $details = null, $code = null, $previous = null) |
|
21 | 21 | { |
22 | 22 | parent::__construct($message, $details, $code, $previous); |
23 | 23 | |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | |
32 | 32 | public function __destruct() |
33 | 33 | { |
34 | - if(!$this->logging) { |
|
34 | + if (!$this->logging) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | $loggers = SVNHelper::getExceptionLoggers(); |
39 | 39 | |
40 | - if(empty($loggers)) { |
|
40 | + if (empty($loggers)) { |
|
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
44 | - foreach($loggers as $callback) { |
|
44 | + foreach ($loggers as $callback) { |
|
45 | 45 | call_user_func($callback, $this); |
46 | 46 | } |
47 | 47 | } |
@@ -101,7 +101,7 @@ |
||
101 | 101 | public function hasAnyErrorCode($codes) |
102 | 102 | { |
103 | 103 | $items = array(); |
104 | - foreach($codes as $code) { |
|
104 | + foreach ($codes as $code) { |
|
105 | 105 | $items[] = ltrim($code, 'e'); |
106 | 106 | } |
107 | 107 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $this->url = $this->helper->getURL().'/'.$this->relativePath; |
29 | 29 | |
30 | 30 | $path = $this->helper->getPath(); |
31 | - if(!empty($relativePath)) { |
|
31 | + if (!empty($relativePath)) { |
|
32 | 32 | $path .= $this->helper->getSlash().$this->relativePath; |
33 | 33 | } |
34 | 34 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | // this is relevant). |
39 | 39 | $this->path = realpath($path); |
40 | 40 | |
41 | - if(!$this->path || !file_exists($this->path)) { |
|
41 | + if (!$this->path || !file_exists($this->path)) { |
|
42 | 42 | throw new SVNHelper_Exception( |
43 | 43 | 'File not found', |
44 | 44 | sprintf( |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | public function runAdd() |
148 | 148 | { |
149 | - if(!$this->isVersioned()) { |
|
149 | + if (!$this->isVersioned()) { |
|
150 | 150 | $this->createAdd()->execute(); |
151 | 151 | $this->clearCache(); |
152 | 152 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function getInfo() |
178 | 178 | { |
179 | - if(!isset($this->cache['info'])) { |
|
179 | + if (!isset($this->cache['info'])) { |
|
180 | 180 | $this->cache['info'] = $this->helper->createInfo($this); |
181 | 181 | } |
182 | 182 | |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function runCommit($message) |
196 | 196 | { |
197 | - if(!$this->isVersioned()) { |
|
197 | + if (!$this->isVersioned()) { |
|
198 | 198 | $this->log('Adding the unversioned file.'); |
199 | 199 | $this->runAdd(); |
200 | 200 | } |
201 | 201 | |
202 | - if(!$this->isCommitted()) { |
|
202 | + if (!$this->isCommitted()) { |
|
203 | 203 | $this->createCommit($message)->execute(); |
204 | 204 | $this->clearCache(); |
205 | 205 | } |
@@ -202,8 +202,7 @@ |
||
202 | 202 | if(!$this->isCommitted()) { |
203 | 203 | $this->createCommit($message)->execute(); |
204 | 204 | $this->clearCache(); |
205 | - } |
|
206 | - else |
|
205 | + } else |
|
207 | 206 | { |
208 | 207 | $this->log('Already committed, nothing to do.'); |
209 | 208 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | protected $result; |
20 | 20 | |
21 | - public function __construct($message, $details, $code, SVNHelper_CommandResult $result, $previous=null) |
|
21 | + public function __construct($message, $details, $code, SVNHelper_CommandResult $result, $previous = null) |
|
22 | 22 | { |
23 | 23 | parent::__construct($message, $details, $code, $previous); |
24 | 24 | $this->result = $result; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function execute() |
58 | 58 | { |
59 | - if(isset($this->result)) { |
|
59 | + if (isset($this->result)) { |
|
60 | 60 | return $this->result; |
61 | 61 | } |
62 | 62 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | putenv('LC_ALL='.$locale); |
67 | 67 | |
68 | 68 | $this->result = $this->_execute(); |
69 | - if(!$this->result instanceof SVNHelper_CommandResult) { |
|
69 | + if (!$this->result instanceof SVNHelper_CommandResult) { |
|
70 | 70 | throw new SVNHelper_Exception( |
71 | 71 | 'Not a valid SVN command result', |
72 | 72 | sprintf( |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | abstract protected function _execute(); |
84 | 84 | |
85 | - protected function buildCommand($mode, $path=null, $params=array()) |
|
85 | + protected function buildCommand($mode, $path = null, $params = array()) |
|
86 | 86 | { |
87 | 87 | $params[] = 'non-interactive'; |
88 | 88 | $params[] = 'username '.$this->helper->getAuthUser(); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $cmd = 'svn '.$mode.' '.$path.' '; |
92 | 92 | |
93 | - foreach($params as $param) { |
|
93 | + foreach ($params as $param) { |
|
94 | 94 | $cmd .= '--'.$param.' '; |
95 | 95 | } |
96 | 96 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param array $params |
109 | 109 | * @return SVNHelper_CommandResult |
110 | 110 | */ |
111 | - protected function execCommand($mode, $path=null, $params=array()) |
|
111 | + protected function execCommand($mode, $path = null, $params = array()) |
|
112 | 112 | { |
113 | 113 | $relative = $this->helper->relativizePath($path); |
114 | 114 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | exec($cmd, $output); |
124 | 124 | |
125 | 125 | $lines = array(); |
126 | - foreach($output as $line) { |
|
126 | + foreach ($output as $line) { |
|
127 | 127 | $lines[] = mb_strtolower(trim(utf8_encode($line))); |
128 | 128 | } |
129 | 129 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | // |
136 | 136 | // Can happen for example when the path is not under version |
137 | 137 | // control. |
138 | - if(isset($lines[0]) && substr($lines[0], 0, 7) == 'skipped') |
|
138 | + if (isset($lines[0]) && substr($lines[0], 0, 7) == 'skipped') |
|
139 | 139 | { |
140 | 140 | $tokens = explode('--', $lines[0]); |
141 | 141 | $message = trim(array_pop($tokens)); |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | // svn: w123456: warning message |
157 | 157 | else |
158 | 158 | { |
159 | - foreach($lines as $line) |
|
159 | + foreach ($lines as $line) |
|
160 | 160 | { |
161 | - if(strstr($line, 'svn:')) |
|
161 | + if (strstr($line, 'svn:')) |
|
162 | 162 | { |
163 | 163 | $result = array(); |
164 | 164 | preg_match_all('/svn:[ ]*(e|warning:[ ]*w)([0-9]+):(.*)/', $line, $result, PREG_PATTERN_ORDER); |
165 | 165 | |
166 | - if(isset($result[1]) && isset($result[1][0])) |
|
166 | + if (isset($result[1]) && isset($result[1][0])) |
|
167 | 167 | { |
168 | 168 | $message = trim($result[3][0]); |
169 | 169 | $code = trim($result[2][0]); |
170 | 170 | $type = self::SVN_ERROR_TYPE_ERROR; |
171 | 171 | |
172 | - if($result[1][0] != 'e') { |
|
172 | + if ($result[1][0] != 'e') { |
|
173 | 173 | $type = self::SVN_ERROR_TYPE_WARNING; |
174 | 174 | } |
175 | 175 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $result = new SVNHelper_CommandResult($this, $cmd, $lines, $errorMessages); |
184 | 184 | |
185 | - if($result->isError()) { |
|
185 | + if ($result->isError()) { |
|
186 | 186 | $this->log(sprintf('[%s] | Command returned errors.', $relative)); |
187 | 187 | } |
188 | 188 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | protected function throwExceptionUnexpected(SVNHelper_CommandResult $result) |
207 | 207 | { |
208 | - if($result->isConnectionFailed()) { |
|
208 | + if ($result->isConnectionFailed()) { |
|
209 | 209 | $this->throwException( |
210 | 210 | t('Could not connect to the remote SVN repository'), |
211 | 211 | '', |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ); |
215 | 215 | } |
216 | 216 | |
217 | - if($result->hasConflicts()) { |
|
217 | + if ($result->hasConflicts()) { |
|
218 | 218 | $this->throwException( |
219 | 219 | t('SVN command reported conflicts'), |
220 | 220 | '', |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ); |
224 | 224 | } |
225 | 225 | |
226 | - if($result->hasLocks()) { |
|
226 | + if ($result->hasLocks()) { |
|
227 | 227 | $this->throwException( |
228 | 228 | t('The target SVN folder or file is locked.'), |
229 | 229 | '', |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | ); |
241 | 241 | } |
242 | 242 | |
243 | - protected function throwException($message, $details, $code, SVNHelper_CommandResult $result, $previous=null) |
|
243 | + protected function throwException($message, $details, $code, SVNHelper_CommandResult $result, $previous = null) |
|
244 | 244 | { |
245 | 245 | $body = |
246 | 246 | '<p>'. |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | '</p>'. |
256 | 256 | '<ul>'; |
257 | 257 | $errors = $result->getErrorMessages(); |
258 | - foreach($errors as $error) { |
|
258 | + foreach ($errors as $error) { |
|
259 | 259 | $body .= |
260 | 260 | '<li>'. |
261 | 261 | $error. |