@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $autoload = realpath($root.'/../vendor/autoload.php'); |
13 | 13 | |
14 | 14 | // we need the autoloader to be present |
15 | - if($autoload === false) |
|
15 | + if ($autoload === false) |
|
16 | 16 | { |
17 | 17 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
18 | 18 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | require_once $autoload; |
24 | 24 | |
25 | - if(!class_exists('\AppLocalize\Localization')) |
|
25 | + if (!class_exists('\AppLocalize\Localization')) |
|
26 | 26 | { |
27 | 27 | die( |
28 | 28 | '<b>ERROR:</b> The translation user interface requires the |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function addAttribute($parent, $name, $value) |
109 | 109 | { |
110 | - if(!$parent instanceof \DOMNode) { |
|
110 | + if (!$parent instanceof \DOMNode) { |
|
111 | 111 | throw new XMLHelper_Exception( |
112 | 112 | 'The specified parent node is not a node instance.', |
113 | 113 | sprintf('Tried adding attribute [%s].', $name), |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | if (!empty($text)) { |
231 | 231 | $fragment = $this->dom->createDocumentFragment(); |
232 | - if(!@$fragment->appendXML($text)) { |
|
232 | + if (!@$fragment->appendXML($text)) { |
|
233 | 233 | throw new XMLHelper_Exception( |
234 | 234 | 'Cannot append XML fragment', |
235 | 235 | sprintf( |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param array $attributes |
272 | 272 | * @return \DOMNode |
273 | 273 | */ |
274 | - function createRoot($name, $attributes=array()) |
|
274 | + function createRoot($name, $attributes = array()) |
|
275 | 275 | { |
276 | 276 | $root = $this->dom->appendChild($this->dom->createElement($name)); |
277 | 277 | $this->addAttributes($root, $attributes); |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | $string = str_replace('<', 'LT_ESCAPE', $string); |
292 | 292 | $string = str_replace('>', 'GT_ESCAPE', $string); |
293 | 293 | |
294 | - $string = str_replace(' ',' ', $string); |
|
295 | - $string = str_replace('&','&', $string); |
|
294 | + $string = str_replace(' ', ' ', $string); |
|
295 | + $string = str_replace('&', '&', $string); |
|
296 | 296 | |
297 | 297 | return $string; |
298 | 298 | } |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public static function downloadXML($xml, $filename = 'download.xml') |
309 | 309 | { |
310 | - if(!headers_sent() && !self::$simulation) { |
|
311 | - header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
310 | + if (!headers_sent() && !self::$simulation) { |
|
311 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | echo $xml; |
@@ -323,11 +323,11 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public static function displayXML($xml) |
325 | 325 | { |
326 | - if(!headers_sent() && !self::$simulation) { |
|
326 | + if (!headers_sent() && !self::$simulation) { |
|
327 | 327 | header('Content-Type:text/xml; charset=utf-8'); |
328 | 328 | } |
329 | 329 | |
330 | - if(self::$simulation) { |
|
330 | + if (self::$simulation) { |
|
331 | 331 | $xml = '<pre>'.htmlspecialchars($xml).'</pre>'; |
332 | 332 | } |
333 | 333 | |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | * @param string[] $customInfo Associative array with name => value pairs for custom tags to add to the output xml |
346 | 346 | * @see buildErrorXML() |
347 | 347 | */ |
348 | - public static function displayErrorXML($code, $message, $title, $customInfo=array()) |
|
348 | + public static function displayErrorXML($code, $message, $title, $customInfo = array()) |
|
349 | 349 | { |
350 | - if(!headers_sent() && !self::$simulation) { |
|
351 | - header('HTTP/1.1 400 Bad Request: ' . $title, true, 400); |
|
350 | + if (!headers_sent() && !self::$simulation) { |
|
351 | + header('HTTP/1.1 400 Bad Request: '.$title, true, 400); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | self::displayXML(self::buildErrorXML($code, $message, $title, $customInfo)); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | protected static $simulation = false; |
358 | 358 | |
359 | - public static function setSimulation($simulate=true) |
|
359 | + public static function setSimulation($simulate = true) |
|
360 | 360 | { |
361 | 361 | self::$simulation = $simulate; |
362 | 362 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @param string $title |
405 | 405 | * @return string |
406 | 406 | */ |
407 | - public static function buildErrorXML($code, $message, $title, $customInfo=array()) |
|
407 | + public static function buildErrorXML($code, $message, $title, $customInfo = array()) |
|
408 | 408 | { |
409 | 409 | $xml = new \DOMDocument('1.0', 'UTF-8'); |
410 | 410 | $xml->formatOutput = true; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $helper->addTextTag($root, 'title', $title); |
419 | 419 | $helper->addTextTag($root, 'request_uri', $_SERVER['REQUEST_URI']); |
420 | 420 | |
421 | - foreach($customInfo as $name => $value) { |
|
421 | + foreach ($customInfo as $name => $value) { |
|
422 | 422 | $helper->addTextTag($root, $name, $value); |
423 | 423 | } |
424 | 424 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public static function string2xml(string $string) : string |
465 | 465 | { |
466 | - if(stristr($string, '<body')) |
|
466 | + if (stristr($string, '<body')) |
|
467 | 467 | { |
468 | 468 | throw new XMLHelper_Exception( |
469 | 469 | 'Cannot convert string with existing body element', |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | // capture all elements except the body tag itself |
495 | 495 | $xml = ''; |
496 | - foreach($root->childNodes as $child) { |
|
496 | + foreach ($root->childNodes as $child) { |
|
497 | 497 | $xml .= $dom->saveXML($child); |
498 | 498 | } |
499 | 499 |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | $contentLength = 0; |
98 | 98 | if (!empty($this->variables)) { |
99 | 99 | foreach ($this->variables as $name => $value) { |
100 | - $this->data .= '--' . $this->mimeBoundary . $this->eol; |
|
101 | - $this->data .= 'Content-Disposition: form-data; name="' . $name . '"' . $this->eol; |
|
100 | + $this->data .= '--'.$this->mimeBoundary.$this->eol; |
|
101 | + $this->data .= 'Content-Disposition: form-data; name="'.$name.'"'.$this->eol; |
|
102 | 102 | $this->data .= $this->eol; |
103 | - $this->data .= $value . $this->eol; |
|
103 | + $this->data .= $value.$this->eol; |
|
104 | 104 | |
105 | 105 | $contentLength += strlen($value); |
106 | 106 | } |
@@ -108,17 +108,17 @@ discard block |
||
108 | 108 | |
109 | 109 | if (!empty($this->files)) { |
110 | 110 | foreach ($this->files as $varName => $def) { |
111 | - $this->data .= '--' . $this->mimeBoundary . $this->eol; |
|
112 | - $this->data .= 'Content-Disposition: form-data; name="' . $varName . '"; filename="' . $def['fileName'] . '"' . $this->eol; |
|
113 | - $this->data .= 'Content-Type: ' . $def['contentType'] . '; charset=' . $def['encoding']; |
|
114 | - $this->data .= $this->eol . $this->eol; |
|
115 | - $this->data .= $def['content'] . $this->eol; |
|
111 | + $this->data .= '--'.$this->mimeBoundary.$this->eol; |
|
112 | + $this->data .= 'Content-Disposition: form-data; name="'.$varName.'"; filename="'.$def['fileName'].'"'.$this->eol; |
|
113 | + $this->data .= 'Content-Type: '.$def['contentType'].'; charset='.$def['encoding']; |
|
114 | + $this->data .= $this->eol.$this->eol; |
|
115 | + $this->data .= $def['content'].$this->eol; |
|
116 | 116 | |
117 | 117 | $contentLength += strlen($def['content']); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - $this->data .= "--" . $this->mimeBoundary . "--" . $this->eol . $this->eol; // finish with two eol's!! |
|
121 | + $this->data .= "--".$this->mimeBoundary."--".$this->eol.$this->eol; // finish with two eol's!! |
|
122 | 122 | |
123 | 123 | //echo '<pre>'.print_r($this->data,true).'</pre>'; |
124 | 124 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | 'http' => array( |
127 | 127 | 'method' => 'POST', |
128 | 128 | 'header' => |
129 | - 'Content-Length: ' . $contentLength . $this->eol . |
|
130 | - 'Content-Type: multipart/form-data; charset=UTF-8; boundary=' . $this->mimeBoundary . $this->eol |
|
129 | + 'Content-Length: '.$contentLength.$this->eol. |
|
130 | + 'Content-Type: multipart/form-data; charset=UTF-8; boundary='.$this->mimeBoundary.$this->eol |
|
131 | 131 | , |
132 | 132 | 'content' => $this->data |
133 | 133 | ) |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $errorMessage = error_get_last(); |
142 | 142 | throw new RequestHelper_Exception( |
143 | 143 | 'Request failed.', |
144 | - 'Request error message: ' . $errorMessage['message'] . ' in ' . $errorMessage['file'] . ':' . $errorMessage['line'], |
|
144 | + 'Request error message: '.$errorMessage['message'].' in '.$errorMessage['file'].':'.$errorMessage['line'], |
|
145 | 145 | self::ERROR_REQUEST_FAILED |
146 | 146 | ); |
147 | 147 | } |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | * @param mixed $value |
9 | 9 | * @return \AppUtils\NumberInfo |
10 | 10 | */ |
11 | -function parseNumber($value, $forceNew=false) |
|
11 | +function parseNumber($value, $forceNew = false) |
|
12 | 12 | { |
13 | - if($value instanceof NumberInfo && $forceNew !== true) { |
|
13 | + if ($value instanceof NumberInfo && $forceNew !== true) { |
|
14 | 14 | return $value; |
15 | 15 | } |
16 | 16 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $args = func_get_args(); |
80 | 80 | |
81 | 81 | // is the localization package installed? |
82 | - if(class_exists('\AppLocalize\Localization')) |
|
82 | + if (class_exists('\AppLocalize\Localization')) |
|
83 | 83 | { |
84 | 84 | return call_user_func_array('\AppLocalize\t', $args); |
85 | 85 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | function init() |
97 | 97 | { |
98 | - if(!class_exists('\AppLocalize\Localization')) { |
|
98 | + if (!class_exists('\AppLocalize\Localization')) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 |
@@ -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 | } |
@@ -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; |