Browse Source

Reformat code to follow coding style

Nils Adermann 11 years ago
parent
commit
f2c48788b8
1 changed files with 8 additions and 26 deletions
  1. 8 26
      src/Composer/Package/Loader/RootPackageLoader.php

+ 8 - 26
src/Composer/Package/Loader/RootPackageLoader.php

@@ -186,8 +186,6 @@ class RootPackageLoader extends ArrayLoader
 
             return $this->guessSvnVersion($config);
         }
-
-        return null;
     }
 
     private function guessGitVersion(array $config)
@@ -307,34 +305,18 @@ class RootPackageLoader extends ArrayLoader
     {
         // try to fetch current version from svn
         if (0 === $this->process->execute('svn info --xml', $output)) {
+            $trunkPath = isset($config['trunk-path']) ? preg_quote($config['trunk-path'], '#') : 'trunk';
+            $branchesPath = isset($config['branches-path']) ? preg_quote($config['branches-path'], '#') : 'branches';
+            $tagsPath = isset($config['tags-path']) ? preg_quote($config['tags-path'], '#') : 'tags';
+
+            $urlPattern = '#<url>.*/('.$trunkPath.'|('.$branchesPath.'|'. $tagsPath .')/(.*))</url>#';
 
-            $regexDelimiter = '#';
-            
-            $trunkPath =
-                isset($config['trunk-path'])
-                ? preg_quote($config['trunk-path'], $regexDelimiter)
-                : 'trunk';
-
-            $branchesPath =
-                isset($config['branches-path'])
-                ? preg_quote($config['branches-path'], $regexDelimiter)
-                : 'branches';
-
-            $tagsPath =
-                isset($config['tags-path'])
-                ? preg_quote($config['tags-path'], $regexDelimiter)
-                : 'tags';
-
-            $urlPattern = $regexDelimiter
-                        . '<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath .')/(.*))</url>'
-                        . $regexDelimiter;
-
-            if(preg_match($urlPattern, $output, $matches)) {
-                if(isset($matches[2]) && isset($matches[3]) && $branchesPath === $matches[2]) {
+            if (preg_match($urlPattern, $output, $matches)) {
+                if (isset($matches[2]) && $branchesPath === $matches[2]) {
                     // we are in a branches path
                     $version = $this->versionParser->normalizeBranch($matches[3]);
                     if ('9999999-dev' === $version) {
-                        $version = 'dev-' . $matches[3];
+                        $version = 'dev-'.$matches[3];
                     }
                     return $version;
                 }