@@ -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 | } |
@@ -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; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | $result = $this->execCommand('add', $this->target->getPath()); |
16 | 16 | |
17 | - if($result->isError()) { |
|
17 | + if ($result->isError()) { |
|
18 | 18 | throw new SVNHelper_Exception( |
19 | 19 | 'Could not add target path', |
20 | 20 | sprintf( |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | $line = $result->getFirstLine(); |
30 | - if(substr($line, 0, 1) != 'a') { |
|
30 | + if (substr($line, 0, 1) != 'a') { |
|
31 | 31 | throw new SVNHelper_Exception( |
32 | 32 | 'Unexpected result for adding a path', |
33 | 33 | sprintf( |
@@ -16,7 +16,7 @@ |
||
16 | 16 | ) |
17 | 17 | ); |
18 | 18 | |
19 | - if($result->isError()) { |
|
19 | + if ($result->isError()) { |
|
20 | 20 | $this->throwExceptionUnexpected($result); |
21 | 21 | } |
22 | 22 |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | |
15 | 15 | $this->params = array(); |
16 | 16 | |
17 | - if($result->isError()) { |
|
17 | + if ($result->isError()) { |
|
18 | 18 | // this error code means the target exists, but is not versioned yet |
19 | - if(!$result->hasErrorCode('200009')) { |
|
19 | + if (!$result->hasErrorCode('200009')) { |
|
20 | 20 | $this->throwExceptionUnexpected($result); |
21 | 21 | } |
22 | 22 | |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | |
30 | 30 | $lines = $result->getOutput(); |
31 | 31 | |
32 | - foreach($lines as $line) |
|
32 | + foreach ($lines as $line) |
|
33 | 33 | { |
34 | - if(!strstr($line, ':')) { |
|
34 | + if (!strstr($line, ':')) { |
|
35 | 35 | continue; |
36 | 36 | } |
37 | 37 | |
38 | 38 | $pos = strpos($line, ':'); |
39 | 39 | $name = str_replace(' ', '-', substr($line, 0, $pos)); |
40 | - $value = trim(substr($line, $pos+1)); |
|
40 | + $value = trim(substr($line, $pos + 1)); |
|
41 | 41 | $this->params[$name] = $value; |
42 | 42 | } |
43 | 43 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | $this->execute(); |
91 | 91 | |
92 | - if(isset($this->params[$name])) { |
|
92 | + if (isset($this->params[$name])) { |
|
93 | 93 | return $this->params[$name]; |
94 | 94 | } |
95 | 95 |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | { |
11 | 11 | $result = $this->execCommand('update', $this->target->getPath()); |
12 | 12 | |
13 | - if($result->isError()) { |
|
13 | + if ($result->isError()) { |
|
14 | 14 | $this->throwExceptionUnexpected($result); |
15 | 15 | } |
16 | 16 | |
17 | 17 | $this->parseResult($result); |
18 | 18 | |
19 | - if(!isset($this->revision)) { |
|
19 | + if (!isset($this->revision)) { |
|
20 | 20 | $this->throwException( |
21 | 21 | 'No update revision returned', |
22 | 22 | 'The command did not return the expected last line with "at revision x".', |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $lines = $result->getLines(); |
47 | 47 | |
48 | - foreach($lines as $line) |
|
48 | + foreach ($lines as $line) |
|
49 | 49 | { |
50 | 50 | $result = array(); |
51 | 51 | preg_match_all('/\A(a|c|d|u)[ ]+(.+)/si', $line, $result, PREG_PATTERN_ORDER); |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | // is this a file update status line? It looks like this: |
54 | 54 | // a c:\path\to\file.ext |
55 | 55 | // ^ status code |
56 | - if(isset($result[0]) && isset($result[1][0]) && !empty($result[1][0])) |
|
56 | + if (isset($result[0]) && isset($result[1][0]) && !empty($result[1][0])) |
|
57 | 57 | { |
58 | 58 | $status = $result[1][0]; |
59 | 59 | $path = $result[2][0]; |
60 | 60 | $obj = new SVNHelper_Command_Update_Status($this, $status, $path); |
61 | 61 | |
62 | - if(!isset($this->stati[$status])) { |
|
62 | + if (!isset($this->stati[$status])) { |
|
63 | 63 | $this->stati[$status] = array(); |
64 | 64 | } |
65 | 65 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // the revision line, "updated to revision X" or "at revision X" |
72 | - if(strstr($line, 'revision ')) { |
|
72 | + if (strstr($line, 'revision ')) { |
|
73 | 73 | preg_match('/(at revision|to revision) ([0-9]+)/si', $line, $result); |
74 | - if(isset($result[2])) { |
|
74 | + if (isset($result[2])) { |
|
75 | 75 | $this->revision = $result[2]; |
76 | 76 | } |
77 | 77 | continue; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | $this->execute(); |
137 | 137 | |
138 | - if(isset($this->stati[$status])) { |
|
138 | + if (isset($this->stati[$status])) { |
|
139 | 139 | return $this->stati[$status]; |
140 | 140 | } |
141 | 141 |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | { |
50 | 50 | $result = $this->execCommand('status', $this->target->getPath(), array('depth empty')); |
51 | 51 | |
52 | - if($result->isError()) { |
|
52 | + if ($result->isError()) { |
|
53 | 53 | $this->throwExceptionUnexpected($result); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $lines = $result->getOutput(); |
57 | 57 | |
58 | - if(empty($lines)) |
|
58 | + if (empty($lines)) |
|
59 | 59 | { |
60 | 60 | $this->status = self::STATUS_NOT_MODIFIED; |
61 | 61 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $this->status = self::STATUS_UNKNOWN; |
65 | 65 | |
66 | 66 | $svnStatusCode = strtolower(substr($lines[0], 0, 1)); |
67 | - if(isset(self::$knownStati[$svnStatusCode])) { |
|
67 | + if (isset(self::$knownStati[$svnStatusCode])) { |
|
68 | 68 | $this->status = self::$knownStati[$svnStatusCode]; |
69 | 69 | } |
70 | 70 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->trimmed = trim($text); |
79 | 79 | $this->lineNumber = $lineNumber; |
80 | 80 | |
81 | - if(empty($this->trimmed)) |
|
81 | + if (empty($this->trimmed)) |
|
82 | 82 | { |
83 | 83 | $this->type = self::TYPE_EMPTY; |
84 | 84 | return; |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | |
87 | 87 | $startChar = substr($this->trimmed, 0, 1); |
88 | 88 | |
89 | - if($startChar === ';') |
|
89 | + if ($startChar === ';') |
|
90 | 90 | { |
91 | 91 | $this->type = self::TYPE_COMMENT; |
92 | 92 | } |
93 | - else if($startChar === '[') |
|
93 | + else if ($startChar === '[') |
|
94 | 94 | { |
95 | 95 | $this->type = self::TYPE_SECTION_DECLARATION; |
96 | 96 | $this->sectionName = trim($this->trimmed, '[]'); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | else |
100 | 100 | { |
101 | 101 | $pos = strpos($this->trimmed, '='); |
102 | - if($pos === false) |
|
102 | + if ($pos === false) |
|
103 | 103 | { |
104 | 104 | $this->type = self::TYPE_INVALID; |
105 | 105 | return; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->type = self::TYPE_VALUE; |
109 | 109 | $this->varName = trim(substr($this->trimmed, 0, $pos)); |
110 | 110 | |
111 | - $this->parseValue(substr($this->trimmed, $pos+1)); |
|
111 | + $this->parseValue(substr($this->trimmed, $pos + 1)); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | |
119 | 119 | $value = $this->varValue; |
120 | 120 | |
121 | - if(substr($value, 0, 1) == '"' && substr($value, -1, 1) == '"') |
|
121 | + if (substr($value, 0, 1) == '"' && substr($value, -1, 1) == '"') |
|
122 | 122 | { |
123 | 123 | $value = trim($value, '"'); |
124 | 124 | $this->quoteStyle = '"'; |
125 | 125 | } |
126 | - else if(substr($value, 0, 1) == "'" && substr($value, -1, 1) == "'") |
|
126 | + else if (substr($value, 0, 1) == "'" && substr($value, -1, 1) == "'") |
|
127 | 127 | { |
128 | 128 | $value = trim($value, "'"); |
129 | 129 | $this->quoteStyle = "'"; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | public function getQuotedVarValue() : string |
146 | 146 | { |
147 | - if($this->quoteStyle === '') { |
|
147 | + if ($this->quoteStyle === '') { |
|
148 | 148 | return $this->getVarValue(); |
149 | 149 | } |
150 | 150 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | public function setValue($value) : IniHelper_Line |
200 | 200 | { |
201 | - if(!is_scalar($value)) |
|
201 | + if (!is_scalar($value)) |
|
202 | 202 | { |
203 | 203 | throw new IniHelper_Exception( |
204 | 204 | 'Cannot use non-scalar values.', |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | public function toString() : string |
220 | 220 | { |
221 | - switch($this->type) |
|
221 | + switch ($this->type) |
|
222 | 222 | { |
223 | 223 | case self::TYPE_EMPTY: |
224 | 224 | case self::TYPE_INVALID: |