Browse Source

Add lib-ICU platform package

Jordi Boggiano 12 years ago
parent
commit
f69418427f
1 changed files with 18 additions and 0 deletions
  1. 18 0
      src/Composer/Repository/PlatformRepository.php

+ 18 - 0
src/Composer/Repository/PlatformRepository.php

@@ -70,6 +70,7 @@ class PlatformRepository extends ArrayRepository
         // Doing it this way to know that functions or constants exist before
         // relying on them.
         foreach ($loadedExtensions as $name) {
+            $prettyVersion = null;
             switch ($name) {
                 case 'curl':
                     $curlVersion = curl_version();
@@ -80,6 +81,23 @@ class PlatformRepository extends ArrayRepository
                     $prettyVersion = ICONV_VERSION;
                     break;
 
+                case 'intl':
+                    $name = 'ICU';
+                    if (defined('INTL_ICU_VERSION')) {
+                        $prettyVersion = INTL_ICU_VERSION;
+                    } else {
+                        $reflector = new \ReflectionExtension('intl');
+
+                        ob_start();
+                        $reflector->info();
+                        $output = ob_get_clean();
+
+                        preg_match('/^ICU version => (.*)$/m', $output, $matches);
+                        $prettyVersion = $matches[1];
+                    }
+
+                    break;
+
                 case 'libxml':
                     $prettyVersion = LIBXML_DOTTED_VERSION;
                     break;