Ver código fonte

Changes after excellent feedback from Jordi

Christian Riesen 13 anos atrás
pai
commit
70e7194b07
1 arquivos alterados com 6 adições e 24 exclusões
  1. 6 24
      src/Composer/Repository/PlatformRepository.php

+ 6 - 24
src/Composer/Repository/PlatformRepository.php

@@ -43,20 +43,13 @@ class PlatformRepository extends ArrayRepository
         
         // Extensions scanning
         foreach ($loadedExtensions as $name) {
-            switch ($name) {
-                // Skipped "extensions"
-                case 'standard':
-                case 'Core':
-                    continue;
-                    
-                // All normal cases for standard extensions    
-                default:
-                    $reflExt = new \ReflectionExtension($name);
-                    $prettyVersion = $reflExt->getVersion();
-                    break;
+            if (in_array($name, array('standard', 'Core'))) {
+                continue;
             }
-            
+
+            $reflExt = new \ReflectionExtension($name);
             try {
+                $prettyVersion = $reflExt->getVersion();
                 $version = $versionParser->normalize($prettyVersion);
             } catch (\UnexpectedValueException $e) {
                 $prettyVersion = '0';
@@ -73,11 +66,6 @@ class PlatformRepository extends ArrayRepository
         // relying on them.
         foreach ($loadedExtensions as $name) {
             switch ($name) {
-                // Skipped "extensions"
-                case 'standard':
-                case 'Core':
-                    continue;
-                    
                 case 'curl':
                     $curlVersion = curl_version();
                     $prettyVersion = $curlVersion['version'];
@@ -96,11 +84,6 @@ class PlatformRepository extends ArrayRepository
                     $prettyVersion = trim($prettyVersion);
                     break;
                     
-                case 'mysqli':
-                    // not so pretty version
-                    $prettyVersion = mysqli_get_client_version();
-                    break;
-                    
                 case 'pcre':
                     $prettyVersion = PCRE_VERSION;
                     break;
@@ -121,8 +104,7 @@ class PlatformRepository extends ArrayRepository
             try {
                 $version = $versionParser->normalize($prettyVersion);
             } catch (\UnexpectedValueException $e) {
-                $prettyVersion = '0';
-                $version = $versionParser->normalize($prettyVersion);
+                continue;
             }
         
             $ext = new MemoryPackage('lib-'.$name, $version, $prettyVersion);