@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return bool |
33 | 33 | */ |
34 | 34 | private function isValidVersionString($versionString) { |
35 | - return (bool)preg_match('/^[0-9.]+$/', $versionString); |
|
35 | + return (bool) preg_match('/^[0-9.]+$/', $versionString); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getVersion($versionSpec) { |
46 | 46 | // * indicates that the version is compatible with all versions |
47 | - if($versionSpec === '*') { |
|
47 | + if ($versionSpec === '*') { |
|
48 | 48 | return new Version('', ''); |
49 | 49 | } |
50 | 50 | |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | $secondVersion = isset($versionElements[1]) ? $versionElements[1] : ''; |
57 | 57 | $secondVersionNumber = substr($secondVersion, 2); |
58 | 58 | |
59 | - switch(count($versionElements)) { |
|
59 | + switch (count($versionElements)) { |
|
60 | 60 | case 1: |
61 | - if(!$this->isValidVersionString($firstVersionNumber)) { |
|
61 | + if (!$this->isValidVersionString($firstVersionNumber)) { |
|
62 | 62 | break; |
63 | 63 | } |
64 | - if(substr($firstVersion, 0, 1) === '>') { |
|
64 | + if (substr($firstVersion, 0, 1) === '>') { |
|
65 | 65 | return new Version($firstVersionNumber, ''); |
66 | 66 | } else { |
67 | 67 | return new Version('', $firstVersionNumber); |
68 | 68 | } |
69 | 69 | case 2: |
70 | - if(!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) { |
|
70 | + if (!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) { |
|
71 | 71 | break; |
72 | 72 | } |
73 | 73 | return new Version($firstVersionNumber, $secondVersionNumber); |
@@ -139,19 +139,19 @@ discard block |
||
139 | 139 | if (isset($dependencies['php']['@attributes']['min-version'])) { |
140 | 140 | $minVersion = $dependencies['php']['@attributes']['min-version']; |
141 | 141 | if ($this->compareSmaller($this->platform->getPhpVersion(), $minVersion)) { |
142 | - $missing[] = (string)$this->l->t('PHP %s or higher is required.', $minVersion); |
|
142 | + $missing[] = (string) $this->l->t('PHP %s or higher is required.', $minVersion); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | if (isset($dependencies['php']['@attributes']['max-version'])) { |
146 | 146 | $maxVersion = $dependencies['php']['@attributes']['max-version']; |
147 | 147 | if ($this->compareBigger($this->platform->getPhpVersion(), $maxVersion)) { |
148 | - $missing[] = (string)$this->l->t('PHP with a version lower than %s is required.', $maxVersion); |
|
148 | + $missing[] = (string) $this->l->t('PHP with a version lower than %s is required.', $maxVersion); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | if (isset($dependencies['php']['@attributes']['min-int-size'])) { |
152 | 152 | $intSize = $dependencies['php']['@attributes']['min-int-size']; |
153 | - if ($intSize > $this->platform->getIntSize()*8) { |
|
154 | - $missing[] = (string)$this->l->t('%sbit or higher PHP required.', $intSize); |
|
153 | + if ($intSize > $this->platform->getIntSize() * 8) { |
|
154 | + $missing[] = (string) $this->l->t('%sbit or higher PHP required.', $intSize); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | return $missing; |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | if (!is_array($supportedDatabases)) { |
175 | 175 | $supportedDatabases = array($supportedDatabases); |
176 | 176 | } |
177 | - $supportedDatabases = array_map(function ($db) { |
|
177 | + $supportedDatabases = array_map(function($db) { |
|
178 | 178 | return $this->getValue($db); |
179 | 179 | }, $supportedDatabases); |
180 | 180 | $currentDatabase = $this->platform->getDatabase(); |
181 | 181 | if (!in_array($currentDatabase, $supportedDatabases)) { |
182 | - $missing[] = (string)$this->l->t('Following databases are supported: %s', join(', ', $supportedDatabases)); |
|
182 | + $missing[] = (string) $this->l->t('Following databases are supported: %s', join(', ', $supportedDatabases)); |
|
183 | 183 | } |
184 | 184 | return $missing; |
185 | 185 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | $commandName = $this->getValue($command); |
210 | 210 | if (!$this->platform->isCommandKnown($commandName)) { |
211 | - $missing[] = (string)$this->l->t('The command line tool %s could not be found', $commandName); |
|
211 | + $missing[] = (string) $this->l->t('The command line tool %s could not be found', $commandName); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | return $missing; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $libName = $this->getValue($lib); |
236 | 236 | $libVersion = $this->platform->getLibraryVersion($libName); |
237 | 237 | if (is_null($libVersion)) { |
238 | - $missing[] = (string)$this->l->t('The library %s is not available.', $libName); |
|
238 | + $missing[] = (string) $this->l->t('The library %s is not available.', $libName); |
|
239 | 239 | continue; |
240 | 240 | } |
241 | 241 | |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | if (isset($lib['@attributes']['min-version'])) { |
244 | 244 | $minVersion = $lib['@attributes']['min-version']; |
245 | 245 | if ($this->compareSmaller($libVersion, $minVersion)) { |
246 | - $missing[] = (string)$this->l->t('Library %s with a version higher than %s is required - available version %s.', |
|
246 | + $missing[] = (string) $this->l->t('Library %s with a version higher than %s is required - available version %s.', |
|
247 | 247 | array($libName, $minVersion, $libVersion)); |
248 | 248 | } |
249 | 249 | } |
250 | 250 | if (isset($lib['@attributes']['max-version'])) { |
251 | 251 | $maxVersion = $lib['@attributes']['max-version']; |
252 | 252 | if ($this->compareBigger($libVersion, $maxVersion)) { |
253 | - $missing[] = (string)$this->l->t('Library %s with a version lower than %s is required - available version %s.', |
|
253 | + $missing[] = (string) $this->l->t('Library %s with a version lower than %s is required - available version %s.', |
|
254 | 254 | array($libName, $maxVersion, $libVersion)); |
255 | 255 | } |
256 | 256 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | return $missing; |
275 | 275 | } |
276 | 276 | if (is_array($oss)) { |
277 | - $oss = array_map(function ($os) { |
|
277 | + $oss = array_map(function($os) { |
|
278 | 278 | return $this->getValue($os); |
279 | 279 | }, $oss); |
280 | 280 | } else { |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | } |
283 | 283 | $currentOS = $this->platform->getOS(); |
284 | 284 | if (!in_array($currentOS, $oss)) { |
285 | - $missing[] = (string)$this->l->t('Following platforms are supported: %s', join(', ', $oss)); |
|
285 | + $missing[] = (string) $this->l->t('Following platforms are supported: %s', join(', ', $oss)); |
|
286 | 286 | } |
287 | 287 | return $missing; |
288 | 288 | } |
@@ -315,12 +315,12 @@ discard block |
||
315 | 315 | |
316 | 316 | if (!is_null($minVersion)) { |
317 | 317 | if ($this->compareSmaller($this->platform->getOcVersion(), $minVersion)) { |
318 | - $missing[] = (string)$this->l->t('Server version %s or higher is required.', $this->toVisibleVersion($minVersion)); |
|
318 | + $missing[] = (string) $this->l->t('Server version %s or higher is required.', $this->toVisibleVersion($minVersion)); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | if (!is_null($maxVersion)) { |
322 | 322 | if ($this->compareBigger($this->platform->getOcVersion(), $maxVersion)) { |
323 | - $missing[] = (string)$this->l->t('Server version %s or lower is required.', $this->toVisibleVersion($maxVersion)); |
|
323 | + $missing[] = (string) $this->l->t('Server version %s or lower is required.', $this->toVisibleVersion($maxVersion)); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | return $missing; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | return '10'; |
339 | 339 | default: |
340 | 340 | if (strpos($version, '9.1.') === 0) { |
341 | - $version = '10.0.' . substr($version, 4); |
|
341 | + $version = '10.0.'.substr($version, 4); |
|
342 | 342 | } |
343 | 343 | return $version; |
344 | 344 | } |
@@ -351,6 +351,6 @@ discard block |
||
351 | 351 | private function getValue($element) { |
352 | 352 | if (isset($element['@value'])) |
353 | 353 | return $element['@value']; |
354 | - return (string)$element; |
|
354 | + return (string) $element; |
|
355 | 355 | } |
356 | 356 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | public function enterNode(Node $node) { |
104 | 104 | if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\Equal) { |
105 | - $this->errors[]= [ |
|
105 | + $this->errors[] = [ |
|
106 | 106 | 'disallowedToken' => '==', |
107 | 107 | 'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED, |
108 | 108 | 'line' => $node->getLine(), |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ]; |
111 | 111 | } |
112 | 112 | if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\NotEqual) { |
113 | - $this->errors[]= [ |
|
113 | + $this->errors[] = [ |
|
114 | 114 | 'disallowedToken' => '!=', |
115 | 115 | 'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED, |
116 | 116 | 'line' => $node->getLine(), |
@@ -214,28 +214,28 @@ discard block |
||
214 | 214 | $alias = strtolower($alias); |
215 | 215 | |
216 | 216 | foreach ($this->blackListedClassNames as $blackListedAlias => $blackListedClassName) { |
217 | - if (strpos($blackListedClassName, $name . '\\') === 0) { |
|
217 | + if (strpos($blackListedClassName, $name.'\\') === 0) { |
|
218 | 218 | $aliasedClassName = str_replace($name, $alias, $blackListedClassName); |
219 | 219 | $this->blackListedClassNames[$aliasedClassName] = $blackListedClassName; |
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | 223 | foreach ($this->blackListedConstants as $blackListedAlias => $blackListedConstant) { |
224 | - if (strpos($blackListedConstant, $name . '\\') === 0 || strpos($blackListedConstant, $name . '::') === 0) { |
|
224 | + if (strpos($blackListedConstant, $name.'\\') === 0 || strpos($blackListedConstant, $name.'::') === 0) { |
|
225 | 225 | $aliasedConstantName = str_replace($name, $alias, $blackListedConstant); |
226 | 226 | $this->blackListedConstants[$aliasedConstantName] = $blackListedConstant; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | 230 | foreach ($this->blackListedFunctions as $blackListedAlias => $blackListedFunction) { |
231 | - if (strpos($blackListedFunction, $name . '\\') === 0 || strpos($blackListedFunction, $name . '::') === 0) { |
|
231 | + if (strpos($blackListedFunction, $name.'\\') === 0 || strpos($blackListedFunction, $name.'::') === 0) { |
|
232 | 232 | $aliasedFunctionName = str_replace($name, $alias, $blackListedFunction); |
233 | 233 | $this->blackListedFunctions[$aliasedFunctionName] = $blackListedFunction; |
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
237 | 237 | foreach ($this->blackListedMethods as $blackListedAlias => $blackListedMethod) { |
238 | - if (strpos($blackListedMethod, $name . '\\') === 0 || strpos($blackListedMethod, $name . '::') === 0) { |
|
238 | + if (strpos($blackListedMethod, $name.'\\') === 0 || strpos($blackListedMethod, $name.'::') === 0) { |
|
239 | 239 | $aliasedMethodName = str_replace($name, $alias, $blackListedMethod); |
240 | 240 | $this->blackListedMethods[$aliasedMethodName] = $blackListedMethod; |
241 | 241 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $lowerName = strtolower($name); |
247 | 247 | |
248 | 248 | if (isset($this->blackListedClassNames[$lowerName])) { |
249 | - $this->errors[]= [ |
|
249 | + $this->errors[] = [ |
|
250 | 250 | 'disallowedToken' => $name, |
251 | 251 | 'errorCode' => $errorCode, |
252 | 252 | 'line' => $node->getLine(), |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | private function checkBlackListConstant($class, $constantName, Node $node) { |
259 | - $name = $class . '::' . $constantName; |
|
259 | + $name = $class.'::'.$constantName; |
|
260 | 260 | $lowerName = strtolower($name); |
261 | 261 | |
262 | 262 | if (isset($this->blackListedConstants[$lowerName])) { |
263 | - $this->errors[]= [ |
|
263 | + $this->errors[] = [ |
|
264 | 264 | 'disallowedToken' => $name, |
265 | 265 | 'errorCode' => CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED, |
266 | 266 | 'line' => $node->getLine(), |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | private function checkBlackListFunction($class, $functionName, Node $node) { |
273 | - $name = $class . '::' . $functionName; |
|
273 | + $name = $class.'::'.$functionName; |
|
274 | 274 | $lowerName = strtolower($name); |
275 | 275 | |
276 | 276 | if (isset($this->blackListedFunctions[$lowerName])) { |
277 | - $this->errors[]= [ |
|
277 | + $this->errors[] = [ |
|
278 | 278 | 'disallowedToken' => $name, |
279 | 279 | 'errorCode' => CodeChecker::STATIC_CALL_NOT_ALLOWED, |
280 | 280 | 'line' => $node->getLine(), |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | private function checkBlackListMethod($class, $functionName, Node $node) { |
287 | - $name = $class . '::' . $functionName; |
|
287 | + $name = $class.'::'.$functionName; |
|
288 | 288 | $lowerName = strtolower($name); |
289 | 289 | |
290 | 290 | if (isset($this->blackListedMethods[$lowerName])) { |
291 | - $this->errors[]= [ |
|
291 | + $this->errors[] = [ |
|
292 | 292 | 'disallowedToken' => $name, |
293 | 293 | 'errorCode' => CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED, |
294 | 294 | 'line' => $node->getLine(), |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | const CLASS_IMPLEMENTS_NOT_ALLOWED = 1001; |
43 | 43 | const STATIC_CALL_NOT_ALLOWED = 1002; |
44 | 44 | const CLASS_CONST_FETCH_NOT_ALLOWED = 1003; |
45 | - const CLASS_NEW_NOT_ALLOWED = 1004; |
|
46 | - const OP_OPERATOR_USAGE_DISCOURAGED = 1005; |
|
47 | - const CLASS_USE_NOT_ALLOWED = 1006; |
|
48 | - const CLASS_METHOD_CALL_NOT_ALLOWED = 1007; |
|
45 | + const CLASS_NEW_NOT_ALLOWED = 1004; |
|
46 | + const OP_OPERATOR_USAGE_DISCOURAGED = 1005; |
|
47 | + const CLASS_USE_NOT_ALLOWED = 1006; |
|
48 | + const CLASS_METHOD_CALL_NOT_ALLOWED = 1007; |
|
49 | 49 | |
50 | 50 | /** @var Parser */ |
51 | 51 | private $parser; |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | $excludes = array_map(function($item) use ($folder) { |
88 | - return $folder . '/' . $item; |
|
88 | + return $folder.'/'.$item; |
|
89 | 89 | }, $excludedDirectories); |
90 | 90 | |
91 | 91 | $iterator = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS); |
92 | 92 | $iterator = new RecursiveCallbackFilterIterator($iterator, function($item) use ($folder, $excludes){ |
93 | 93 | /** @var SplFileInfo $item */ |
94 | - foreach($excludes as $exclude) { |
|
94 | + foreach ($excludes as $exclude) { |
|
95 | 95 | if (substr($item->getPath(), 0, strlen($exclude)) === $exclude) { |
96 | 96 | return false; |
97 | 97 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $errors = []; |
80 | 80 | |
81 | - $info = $this->infoParser->parse($appPath . '/appinfo/info.xml'); |
|
81 | + $info = $this->infoParser->parse($appPath.'/appinfo/info.xml'); |
|
82 | 82 | |
83 | 83 | if (isset($info['dependencies']['owncloud']['@attributes']['min-version']) && (isset($info['requiremin']) || isset($info['require']))) { |
84 | 84 | $this->emit('InfoChecker', 'duplicateRequirement', ['min']); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | foreach ($info as $key => $value) { |
110 | - if(is_array($value)) { |
|
110 | + if (is_array($value)) { |
|
111 | 111 | $value = json_encode($value); |
112 | 112 | } |
113 | 113 | if (in_array($key, $this->mandatoryFields)) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | if (in_array($key, $this->deprecatedFields)) { |
124 | 124 | // skip empty arrays - empty arrays for remote and public are always added |
125 | - if($value === '[]' && in_array($key, ['public', 'remote', 'info'])) { |
|
125 | + if ($value === '[]' && in_array($key, ['public', 'remote', 'info'])) { |
|
126 | 126 | continue; |
127 | 127 | } |
128 | 128 | $this->emit('InfoChecker', 'deprecatedFieldFound', [$key, $value]); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | foreach ($this->mandatoryFields as $key) { |
136 | - if(!isset($info[$key])) { |
|
136 | + if (!isset($info[$key])) { |
|
137 | 137 | $this->emit('InfoChecker', 'mandatoryFieldMissing', [$key]); |
138 | 138 | $errors[] = [ |
139 | 139 | 'type' => 'mandatoryFieldMissing', |
@@ -142,17 +142,17 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - $versionFile = $appPath . '/appinfo/version'; |
|
145 | + $versionFile = $appPath.'/appinfo/version'; |
|
146 | 146 | if (is_file($versionFile)) { |
147 | 147 | $version = trim(file_get_contents($versionFile)); |
148 | 148 | if (isset($info['version'])) { |
149 | - if($info['version'] !== $version) { |
|
149 | + if ($info['version'] !== $version) { |
|
150 | 150 | $this->emit('InfoChecker', 'differentVersions', |
151 | 151 | [$version, $info['version']]); |
152 | 152 | $errors[] = [ |
153 | 153 | 'type' => 'differentVersions', |
154 | - 'message' => 'appinfo/version: ' . $version . |
|
155 | - ' - appinfo/info.xml: ' . $info['version'], |
|
154 | + 'message' => 'appinfo/version: '.$version. |
|
155 | + ' - appinfo/info.xml: '.$info['version'], |
|
156 | 156 | ]; |
157 | 157 | } else { |
158 | 158 | $this->emit('InfoChecker', 'sameVersions', [$versionFile]); |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | return null; |
50 | 50 | } |
51 | 51 | |
52 | - if(!is_null($this->cache)) { |
|
53 | - $fileCacheKey = $file . filemtime($file); |
|
52 | + if (!is_null($this->cache)) { |
|
53 | + $fileCacheKey = $file.filemtime($file); |
|
54 | 54 | if ($cachedValue = $this->cache->get($fileCacheKey)) { |
55 | 55 | return json_decode($cachedValue, true); |
56 | 56 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $array['activity']['providers'] = $array['activity']['providers']['provider']; |
167 | 167 | } |
168 | 168 | |
169 | - if(!is_null($this->cache)) { |
|
169 | + if (!is_null($this->cache)) { |
|
170 | 170 | $this->cache->set($fileCacheKey, json_encode($array)); |
171 | 171 | } |
172 | 172 | return $array; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | function xmlToArray($xml) { |
180 | 180 | if (!$xml->children()) { |
181 | - return (string)$xml; |
|
181 | + return (string) $xml; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | $array = []; |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | $data = [ |
195 | 195 | '@attributes' => [], |
196 | 196 | ]; |
197 | - if (!count($node->children())){ |
|
198 | - $value = (string)$node; |
|
197 | + if (!count($node->children())) { |
|
198 | + $value = (string) $node; |
|
199 | 199 | if (!empty($value)) { |
200 | - $data['@value'] = (string)$node; |
|
200 | + $data['@value'] = (string) $node; |
|
201 | 201 | } |
202 | 202 | } else { |
203 | 203 | $data = array_merge($data, $this->xmlToArray($node)); |
204 | 204 | } |
205 | 205 | foreach ($attributes as $attr => $value) { |
206 | - $data['@attributes'][$attr] = (string)$value; |
|
206 | + $data['@attributes'][$attr] = (string) $value; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | if ($totalElement > 1) { |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | break; |
91 | 91 | |
92 | 92 | case 'openssl': |
93 | - $prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]?).*}', function ($match) { |
|
94 | - return $match[1] . (empty($match[2]) ? '' : '.' . (ord($match[2]) - 96)); |
|
93 | + $prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]?).*}', function($match) { |
|
94 | + return $match[1].(empty($match[2]) ? '' : '.'.(ord($match[2]) - 96)); |
|
95 | 95 | }, OPENSSL_VERSION_TEXT); |
96 | 96 | break; |
97 | 97 | |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | return '9999999-dev'; |
167 | 167 | } |
168 | 168 | if ('dev-' === strtolower(substr($version, 0, 4))) { |
169 | - return 'dev-' . substr($version, 4); |
|
169 | + return 'dev-'.substr($version, 4); |
|
170 | 170 | } |
171 | 171 | // match classical versioning |
172 | - if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?' . self::$modifierRegex . '$}i', $version, $matches)) { |
|
172 | + if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?'.self::$modifierRegex.'$}i', $version, $matches)) { |
|
173 | 173 | $version = $matches[1] |
174 | 174 | . (!empty($matches[2]) ? $matches[2] : '.0') |
175 | 175 | . (!empty($matches[3]) ? $matches[3] : '.0') |
176 | 176 | . (!empty($matches[4]) ? $matches[4] : '.0'); |
177 | 177 | $index = 5; |
178 | - } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) { // match date-based versioning |
|
178 | + } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)'.self::$modifierRegex.'$}i', $version, $matches)) { // match date-based versioning |
|
179 | 179 | $version = preg_replace('{\D}', '-', $matches[1]); |
180 | 180 | $index = 2; |
181 | - } elseif (preg_match('{^v?(\d{4,})(\.\d+)?(\.\d+)?(\.\d+)?' . self::$modifierRegex . '$}i', $version, $matches)) { |
|
181 | + } elseif (preg_match('{^v?(\d{4,})(\.\d+)?(\.\d+)?(\.\d+)?'.self::$modifierRegex.'$}i', $version, $matches)) { |
|
182 | 182 | $version = $matches[1] |
183 | 183 | . (!empty($matches[2]) ? $matches[2] : '.0') |
184 | 184 | . (!empty($matches[3]) ? $matches[3] : '.0') |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | if ('stable' === $matches[$index]) { |
192 | 192 | return $version; |
193 | 193 | } |
194 | - $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? $matches[$index + 1] : ''); |
|
194 | + $version .= '-'.$this->expandStability($matches[$index]).(!empty($matches[$index + 1]) ? $matches[$index + 1] : ''); |
|
195 | 195 | } |
196 | 196 | if (!empty($matches[$index + 2])) { |
197 | 197 | $version .= '-dev'; |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | return $version; |
200 | 200 | } |
201 | 201 | $extraMessage = ''; |
202 | - if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) { |
|
203 | - $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version'; |
|
204 | - } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) { |
|
205 | - $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-'; |
|
202 | + if (preg_match('{ +as +'.preg_quote($version).'$}', $fullVersion)) { |
|
203 | + $extraMessage = ' in "'.$fullVersion.'", the alias must be an exact version'; |
|
204 | + } elseif (preg_match('{^'.preg_quote($version).' +as +}', $fullVersion)) { |
|
205 | + $extraMessage = ' in "'.$fullVersion.'", the alias source must be an exact version, if it is a branch name you should prefix it with dev-'; |
|
206 | 206 | } |
207 | - throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage); |
|
207 | + throw new \UnexpectedValueException('Invalid version string "'.$version.'"'.$extraMessage); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return string Formatted date and time string |
238 | 238 | */ |
239 | 239 | public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) { |
240 | - return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l); |
|
240 | + return $this->format($timestamp, 'datetime', $formatDate.'|'.$formatTime, $timeZone, $l); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $formatDate .= '^'; |
257 | 257 | } |
258 | 258 | |
259 | - return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l); |
|
259 | + return $this->format($timestamp, 'datetime', $formatDate.'|'.$formatTime, $timeZone, $l); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -56,15 +56,15 @@ |
||
56 | 56 | public function connectWatcher() { |
57 | 57 | // Do not connect if we are not setup yet! |
58 | 58 | if ($this->config->getValue('instanceid', null) !== null) { |
59 | - $this->root->listen('\OC\Files', 'postWrite', function (Node $node) { |
|
59 | + $this->root->listen('\OC\Files', 'postWrite', function(Node $node) { |
|
60 | 60 | $this->getWatcher()->postWrite($node); |
61 | 61 | }); |
62 | 62 | |
63 | - $this->root->listen('\OC\Files', 'preDelete', function (Node $node) { |
|
63 | + $this->root->listen('\OC\Files', 'preDelete', function(Node $node) { |
|
64 | 64 | $this->getWatcher()->preDelete($node); |
65 | 65 | }); |
66 | 66 | |
67 | - $this->root->listen('\OC\Files', 'postDelete', function (Node $node) { |
|
67 | + $this->root->listen('\OC\Files', 'postDelete', function(Node $node) { |
|
68 | 68 | $this->getWatcher()->postDelete($node); |
69 | 69 | }); |
70 | 70 | } |