当前位置: 首页>>代码示例>>PHP>>正文


PHP ReflectionExtension::info方法代码示例

本文整理汇总了PHP中ReflectionExtension::info方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionExtension::info方法的具体用法?PHP ReflectionExtension::info怎么用?PHP ReflectionExtension::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReflectionExtension的用法示例。


在下文中一共展示了ReflectionExtension::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: info

 /**
  * Prints phpinfo block for the extension
  * @return void
  */
 public function info()
 {
     if ($this->reflectionSource) {
         $this->reflectionSource->info();
     } else {
         parent::info();
     }
 }
开发者ID:naderman,项目名称:pflow,代码行数:12,代码来源:extension.php

示例2: getIcuVersion

 protected function getIcuVersion()
 {
     if (defined('INTL_ICU_VERSION')) {
         $version = INTL_ICU_VERSION;
     } else {
         $reflector = new \ReflectionExtension('intl');
         ob_start();
         $reflector->info();
         $output = strip_tags(ob_get_clean());
         preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
         $version = $matches[1];
     }
     return $version;
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:14,代码来源:IcuAwareTestCase.php

示例3: getIntlExtensionIcuVersion

 protected function getIntlExtensionIcuVersion()
 {
     if (isset(self::$icuVersion)) {
         return self::$icuVersion;
     }
     if (!$this->isIntlExtensionLoaded()) {
         throw new \RuntimeException('The intl extension is not available');
     }
     if (defined('INTL_ICU_VERSION')) {
         return INTL_ICU_VERSION;
     }
     $reflector = new \ReflectionExtension('intl');
     ob_start();
     $reflector->info();
     $output = ob_get_clean();
     preg_match('/^ICU version => (.*)$/m', $output, $matches);
     self::$icuVersion = $matches[1];
     return self::$icuVersion;
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:19,代码来源:LocalizedTestCase.php

示例4: getIcuVersion

 protected function getIcuVersion()
 {
     static $icuVersion = null;
     if (defined('INTL_ICU_VERSION')) {
         return INTL_ICU_VERSION;
     }
     if ($icuVersion === null) {
         $icuVersion = 0;
         $ext = new ReflectionExtension('intl');
         ob_start();
         $ext->info();
         $info = ob_get_contents();
         if (preg_match('/ICU Version => (.*)/i', $info, $match)) {
             $icuVersion = $match[1];
         }
         ob_end_clean();
     }
     return $icuVersion;
 }
开发者ID:horros,项目名称:agavi,代码行数:19,代码来源:AgaviDecimalFormatterTest.php

示例5: __construct

 public function __construct($locale = 'en')
 {
     $this->setName('Locales');
     $this->addRequirement(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension (used for validators).');
     if (class_exists('Collator')) {
         $this->addRecommendation(null !== new \Collator('fr'), 'intl extension should be correctly configured', 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.');
     }
     if (class_exists('Locale')) {
         if (defined('INTL_ICU_VERSION')) {
             $version = INTL_ICU_VERSION;
         } else {
             $reflector = new \ReflectionExtension('intl');
             ob_start();
             $reflector->info();
             $output = strip_tags(ob_get_clean());
             preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
             $version = $matches[1];
         }
         $this->addRecommendation(version_compare($version, '4.0', '>='), 'intl ICU version should be at least 4+', 'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).');
     }
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:21,代码来源:LocalesRequirements.php

示例6: initialize

 protected function initialize()
 {
     parent::initialize();
     $versionParser = new VersionParser();
     // Add each of the override versions as options.
     // Later we might even replace the extensions instead.
     foreach ($this->overrides as $override) {
         // Check that it's a platform package.
         if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
             throw new \InvalidArgumentException('Invalid platform package name in config.platform: ' . $override['name']);
         }
         $version = $versionParser->normalize($override['version']);
         $package = new CompletePackage($override['name'], $version, $override['version']);
         $package->setDescription('Package overridden via config.platform');
         $package->setExtra(array('config.platform' => true));
         parent::addPackage($package);
     }
     $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
     $version = $versionParser->normalize($prettyVersion);
     $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
     $composerPluginApi->setDescription('The Composer Plugin API');
     $this->addPackage($composerPluginApi);
     try {
         $prettyVersion = PHP_VERSION;
         $version = $versionParser->normalize($prettyVersion);
     } catch (\UnexpectedValueException $e) {
         $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
         $version = $versionParser->normalize($prettyVersion);
     }
     $php = new CompletePackage('php', $version, $prettyVersion);
     $php->setDescription('The PHP interpreter');
     $this->addPackage($php);
     if (PHP_INT_SIZE === 8) {
         $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
         $php64->setDescription('The PHP interpreter, 64bit');
         $this->addPackage($php64);
     }
     $loadedExtensions = get_loaded_extensions();
     // Extensions scanning
     foreach ($loadedExtensions as $name) {
         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';
             $version = $versionParser->normalize($prettyVersion);
         }
         $packageName = $this->buildPackageName($name);
         $ext = new CompletePackage($packageName, $version, $prettyVersion);
         $ext->setDescription('The ' . $name . ' PHP extension');
         $this->addPackage($ext);
     }
     // Another quick loop, just for possible libraries
     // Doing it this way to know that functions or constants exist before
     // relying on them.
     foreach ($loadedExtensions as $name) {
         $prettyVersion = null;
         $description = 'The ' . $name . ' PHP library';
         switch ($name) {
             case 'curl':
                 $curlVersion = curl_version();
                 $prettyVersion = $curlVersion['version'];
                 break;
             case 'iconv':
                 $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;
             case 'openssl':
                 $prettyVersion = preg_replace_callback('{^(?:OpenSSL\\s*)?([0-9.]+)([a-z]*).*}', function ($match) {
                     if (empty($match[2])) {
                         return $match[1];
                     }
                     // OpenSSL versions add another letter when they reach Z.
                     // e.g. OpenSSL 0.9.8zh 3 Dec 2015
                     if (!preg_match('{^z*[a-z]$}', $match[2])) {
                         // 0.9.8abc is garbage
                         return 0;
                     }
                     $len = strlen($match[2]);
                     $patchVersion = ($len - 1) * 26;
                     // All Z
//.........这里部分代码省略.........
开发者ID:alcaeus,项目名称:composer,代码行数:101,代码来源:PlatformRepository.php

示例7: __construct

 /**
  * Constructor that initializes the requirements.
  */
 public function __construct()
 {
     /* mandatory requirements follow */
     $installedPhpVersion = phpversion();
     $this->addRequirement(version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
             Before using Symfony, upgrade your PHP installation, preferably to the latest version.', $installedPhpVersion, self::REQUIRED_PHP_VERSION), sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion));
     $this->addRequirement(is_dir(__DIR__ . '/../vendor/composer'), 'Vendor libraries must be installed', 'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' . 'Then run "<strong>php composer.phar install</strong>" to install them.');
     $this->addRequirement(file_get_contents(__FILE__) == file_get_contents(__DIR__ . '/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'), 'Outdated requirements file', 'Your requirements file is outdated. Run composer install and re-check your configuration.');
     $baseDir = basename(__DIR__);
     $this->addRequirement(is_writable(__DIR__ . '/cache'), "{$baseDir}/cache/ directory must be writable", "Change the permissions of the \"<strong>{$baseDir}/cache/</strong>\" directory so that the web server can write into it.");
     $this->addRequirement(is_writable(__DIR__ . '/logs'), "{$baseDir}/logs/ directory must be writable", "Change the permissions of the \"<strong>{$baseDir}/logs/</strong>\" directory so that the web server can write into it.");
     $this->addPhpIniRequirement('date.timezone', true, false, 'date.timezone setting must be set', 'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).');
     if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
         $this->addRequirement(in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers()), sprintf('Default timezone "%s" is not supported by your installation of PHP', date_default_timezone_get()), 'Fix your <strong>php.ini</strong> file (check for typos and have a look at the list of deprecated timezones http://php.net/manual/en/timezones.others.php).');
     }
     $this->addRequirement(function_exists('json_encode'), 'json_encode() must be available', 'Install and enable the <strong>JSON</strong> extension.');
     $this->addRequirement(function_exists('session_start'), 'session_start() must be available', 'Install and enable the <strong>session</strong> extension.');
     $this->addRequirement(function_exists('ctype_alpha'), 'ctype_alpha() must be available', 'Install and enable the <strong>ctype</strong> extension.');
     $this->addRequirement(function_exists('token_get_all'), 'token_get_all() must be available', 'Install and enable the <strong>Tokenizer</strong> extension.');
     $this->addRequirement(function_exists('simplexml_import_dom'), 'simplexml_import_dom() must be available', 'Install and enable the <strong>SimpleXML</strong> extension.');
     $this->addRequirement(!(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='), 'APC version must be at least 3.0.17', 'Upgrade your <strong>APC</strong> extension (3.0.17+)');
     $this->addPhpIniRequirement('detect_unicode', false);
     $this->addPhpIniRequirement('suhosin.executor.include.whitelist', create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), true, 'suhosin.executor.include.whitelist must be configured correctly in php.ini', 'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.');
     $pcreVersion = defined('PCRE_VERSION') ? (double) PCRE_VERSION : null;
     $this->addRequirement(null !== $pcreVersion && $pcreVersion > 8.0, sprintf('PCRE extension must be available and at least 8.0 (%s installed)', $pcreVersion ? $pcreVersion : 'not'), 'Upgrade your <strong>PCRE</strong> extension (8.0+)');
     /* optional recommendations follow */
     $this->addRecommendation(version_compare($installedPhpVersion, '5.3.4', '>='), sprintf('Your project might not work properly ("Notice: Trying to get property of non-object") due to the PHP bug #52083 before PHP 5.3.4 (%s installed)', $installedPhpVersion), 'Install PHP 5.3.4 or newer');
     $this->addRecommendation(version_compare($installedPhpVersion, '5.3.8', '>='), sprintf('Annotations might not work properly due to the PHP bug #55156 before PHP 5.3.8 (%s installed)', $installedPhpVersion), 'Install PHP 5.3.8 or newer if your project uses annotations');
     $this->addRecommendation(class_exists('DomDocument'), 'PHP-XML module should be installed', 'Install and enable the <strong>PHP-XML</strong> module.');
     $this->addRecommendation(function_exists('mb_strlen'), 'mb_strlen() should be available', 'Install and enable the <strong>mbstring</strong> extension.');
     $this->addRecommendation(function_exists('iconv'), 'iconv() should be available', 'Install and enable the <strong>iconv</strong> extension.');
     $this->addRecommendation(function_exists('utf8_decode'), 'utf8_decode() should be available', 'Install and enable the <strong>XML</strong> extension.');
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         $this->addRecommendation(function_exists('posix_isatty'), 'posix_isatty() should be available', 'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).');
     }
     $this->addRecommendation(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension (used for validators).');
     if (class_exists('Locale')) {
         if (defined('INTL_ICU_VERSION')) {
             $version = INTL_ICU_VERSION;
         } else {
             $reflector = new ReflectionExtension('intl');
             ob_start();
             $reflector->info();
             $output = strip_tags(ob_get_clean());
             preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
             $version = $matches[1];
         }
         $this->addRecommendation(version_compare($version, '4.0', '>='), 'intl ICU version should be at least 4+', 'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).');
     }
     $accelerator = function_exists('apc_store') && ini_get('apc.enabled') || function_exists('eaccelerator_put') && ini_get('eaccelerator.enable') || function_exists('xcache_set');
     $this->addRecommendation($accelerator, 'a PHP accelerator should be installed', 'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).');
     $this->addPhpIniRecommendation('short_open_tag', false);
     $this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
     $this->addPhpIniRecommendation('register_globals', false, true);
     $this->addPhpIniRecommendation('session.auto_start', false);
     $this->addRecommendation(class_exists('PDO'), 'PDO should be installed', 'Install <strong>PDO</strong> (mandatory for Doctrine).');
     if (class_exists('PDO')) {
         $drivers = PDO::getAvailableDrivers();
         $this->addRecommendation(count($drivers), sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), 'Install <strong>PDO drivers</strong> (mandatory for Doctrine).');
     }
 }
开发者ID:performance-engine,项目名称:performance-engine,代码行数:64,代码来源:SymfonyRequirements.php

示例8: __construct

 /**
  * Constructor that initializes the requirements.
  */
 public function __construct()
 {
     /* mandatory requirements follow */
     $installedPhpVersion = phpversion();
     $this->addRequirement(version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
             Before using Symfony, upgrade your PHP installation, preferably to the latest version.', $installedPhpVersion, self::REQUIRED_PHP_VERSION), sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion));
     $this->addRequirement(version_compare($installedPhpVersion, '5.3.16', '!='), 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it', 'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)');
     $this->addRequirement(is_dir(__DIR__ . '/../vendor/composer'), 'Vendor libraries must be installed', 'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' . 'Then run "<strong>php composer.phar install</strong>" to install them.');
     $baseDir = basename(__DIR__);
     $this->addRequirement(is_writable(__DIR__ . '/cache'), "{$baseDir}/cache/ directory must be writable", "Change the permissions of the \"<strong>{$baseDir}/cache/</strong>\" directory so that the web server can write into it.");
     $this->addRequirement(is_writable(__DIR__ . '/logs'), "{$baseDir}/logs/ directory must be writable", "Change the permissions of the \"<strong>{$baseDir}/logs/</strong>\" directory so that the web server can write into it.");
     $this->addPhpIniRequirement('date.timezone', true, false, 'date.timezone setting must be set', 'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).');
     if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
         $timezones = array();
         foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
             foreach ($abbreviations as $abbreviation) {
                 $timezones[$abbreviation['timezone_id']] = true;
             }
         }
         $this->addRequirement(isset($timezones[date_default_timezone_get()]), sprintf('Configured default timezone "%s" must be supported by your installation of PHP', date_default_timezone_get()), 'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.');
     }
     $this->addRequirement(function_exists('json_encode'), 'json_encode() must be available', 'Install and enable the <strong>JSON</strong> extension.');
     $this->addRequirement(function_exists('session_start'), 'session_start() must be available', 'Install and enable the <strong>session</strong> extension.');
     $this->addRequirement(function_exists('ctype_alpha'), 'ctype_alpha() must be available', 'Install and enable the <strong>ctype</strong> extension.');
     $this->addRequirement(function_exists('token_get_all'), 'token_get_all() must be available', 'Install and enable the <strong>Tokenizer</strong> extension.');
     $this->addRequirement(function_exists('simplexml_import_dom'), 'simplexml_import_dom() must be available', 'Install and enable the <strong>SimpleXML</strong> extension.');
     if (function_exists('apc_store') && ini_get('apc.enabled')) {
         $this->addRequirement(version_compare(phpversion('apc'), '3.0.17', '>='), 'APC version must be at least 3.0.17', 'Upgrade your <strong>APC</strong> extension (3.0.17+).');
     }
     $this->addPhpIniRequirement('detect_unicode', false);
     if (extension_loaded('suhosin')) {
         $this->addPhpIniRequirement('suhosin.executor.include.whitelist', create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), false, 'suhosin.executor.include.whitelist must be configured correctly in php.ini', 'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.');
     }
     if (extension_loaded('xdebug')) {
         $this->addPhpIniRequirement('xdebug.show_exception_trace', false, true);
         $this->addPhpIniRequirement('xdebug.scream', false, true);
         $this->addPhpIniRecommendation('xdebug.max_nesting_level', create_function('$cfgValue', 'return $cfgValue > 100;'), true, 'xdebug.max_nesting_level should be above 100 in php.ini', 'Set "<strong>xdebug.max_nesting_level</strong>" to e.g. "<strong>250</strong>" in php.ini<a href="#phpini">*</a> to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.');
     }
     $pcreVersion = defined('PCRE_VERSION') ? (double) PCRE_VERSION : null;
     $this->addRequirement(null !== $pcreVersion, 'PCRE extension must be available', 'Install the <strong>PCRE</strong> extension (version 8.0+).');
     /* optional recommendations follow */
     $this->addRecommendation(file_get_contents(__FILE__) === file_get_contents(__DIR__ . '/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'), 'Requirements file should be up-to-date', 'Your requirements file is outdated. Run composer install and re-check your configuration.');
     $this->addRecommendation(version_compare($installedPhpVersion, '5.3.4', '>='), 'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions', 'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.');
     $this->addRecommendation(version_compare($installedPhpVersion, '5.3.8', '>='), 'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156', 'Install PHP 5.3.8 or newer if your project uses annotations.');
     $this->addRecommendation(version_compare($installedPhpVersion, '5.4.0', '!='), 'You should not use PHP 5.4.0 due to the PHP bug #61453', 'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.');
     if (null !== $pcreVersion) {
         $this->addRecommendation($pcreVersion >= 8.0, sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion), '<strong>PCRE 8.0+</strong> is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.');
     }
     $this->addRecommendation(class_exists('DomDocument'), 'PHP-XML module should be installed', 'Install and enable the <strong>PHP-XML</strong> module.');
     $this->addRecommendation(function_exists('mb_strlen'), 'mb_strlen() should be available', 'Install and enable the <strong>mbstring</strong> extension.');
     $this->addRecommendation(function_exists('iconv'), 'iconv() should be available', 'Install and enable the <strong>iconv</strong> extension.');
     $this->addRecommendation(function_exists('utf8_decode'), 'utf8_decode() should be available', 'Install and enable the <strong>XML</strong> extension.');
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         $this->addRecommendation(function_exists('posix_isatty'), 'posix_isatty() should be available', 'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).');
     }
     $this->addRecommendation(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension (used for validators).');
     if (class_exists('Collator')) {
         $this->addRecommendation(null !== new Collator('fr_FR'), 'intl extension should be correctly configured', 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.');
     }
     if (class_exists('Locale')) {
         if (defined('INTL_ICU_VERSION')) {
             $version = INTL_ICU_VERSION;
         } else {
             $reflector = new ReflectionExtension('intl');
             ob_start();
             $reflector->info();
             $output = strip_tags(ob_get_clean());
             preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
             $version = $matches[1];
         }
         $this->addRecommendation(version_compare($version, '4.0', '>='), 'intl ICU version should be at least 4+', 'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).');
     }
     $accelerator = function_exists('apc_store') && ini_get('apc.enabled') || function_exists('eaccelerator_put') && ini_get('eaccelerator.enable') || function_exists('xcache_set');
     $this->addRecommendation($accelerator, 'a PHP accelerator should be installed', 'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).');
     $this->addPhpIniRecommendation('short_open_tag', false);
     $this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
     $this->addPhpIniRecommendation('register_globals', false, true);
     $this->addPhpIniRecommendation('session.auto_start', false);
     $this->addRecommendation(class_exists('PDO'), 'PDO should be installed', 'Install <strong>PDO</strong> (mandatory for Doctrine).');
     if (class_exists('PDO')) {
         $drivers = PDO::getAvailableDrivers();
         $this->addRecommendation(count($drivers), sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), 'Install <strong>PDO drivers</strong> (mandatory for Doctrine).');
     }
 }
开发者ID:4Queen,项目名称:php-buildpack,代码行数:87,代码来源:SymfonyRequirements.php

示例9: initialize

 protected function initialize()
 {
     $loadedExtensions = get_loaded_extensions();
     $packages = array();
     // Extensions scanning
     foreach ($loadedExtensions as $name) {
         if (in_array($name, array('standard', 'Core'))) {
             continue;
         }
         $ext = new \ReflectionExtension($name);
         try {
             $prettyVersion = $ext->getVersion();
             $prettyVersion = $this->normalizeVersion($prettyVersion);
         } catch (\UnexpectedValueException $e) {
             $prettyVersion = '0';
             $prettyVersion = $this->normalizeVersion($prettyVersion);
         }
         $packages[$this->buildPackageName($name)] = $prettyVersion;
     }
     foreach ($loadedExtensions as $name) {
         $prettyVersion = null;
         switch ($name) {
             case 'curl':
                 $curlVersion = curl_version();
                 $prettyVersion = $curlVersion['version'];
                 break;
             case 'iconv':
                 $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;
             case 'openssl':
                 $prettyVersion = preg_replace_callback('{^(?:OpenSSL\\s*)?([0-9.]+)([a-z]?).*}', function ($match) {
                     return $match[1] . (empty($match[2]) ? '' : '.' . (ord($match[2]) - 96));
                 }, OPENSSL_VERSION_TEXT);
                 break;
             case 'pcre':
                 $prettyVersion = preg_replace('{^(\\S+).*}', '$1', PCRE_VERSION);
                 break;
             case 'uuid':
                 $prettyVersion = phpversion('uuid');
                 break;
             case 'xsl':
                 $prettyVersion = LIBXSLT_DOTTED_VERSION;
                 break;
             default:
                 // None handled extensions have no special cases, skip
                 continue 2;
         }
         try {
             $prettyVersion = $this->normalizeVersion($prettyVersion);
         } catch (\UnexpectedValueException $e) {
             continue;
         }
         $packages[$this->buildPackageName($name)] = $prettyVersion;
     }
     return $packages;
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:72,代码来源:PlatformRepository.php

示例10: __construct

 /**
  * Constructor that initializes the requirements.
  */
 public function __construct()
 {
     /* mandatory requirements follow */
     $installedPhpVersion = phpversion();
     $this->addRequirement(version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
             Before using Symfony, upgrade your PHP installation, preferably to the latest version.', $installedPhpVersion, self::REQUIRED_PHP_VERSION), sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion));
     $this->addRequirement(is_dir(__DIR__ . '/../vendor/symfony'), 'Vendor libraries must be installed', 'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' . 'Then run "<strong>php composer.phar install</strong>" to install them.');
     $this->addRequirement(is_writable(__DIR__ . '/../app/cache'), 'app/cache/ directory must be writable', 'Change the permissions of the "<strong>app/cache/</strong>" directory so that the web server can write into it.');
     $this->addRequirement(is_writable(__DIR__ . '/../app/logs'), 'app/logs/ directory must be writable', 'Change the permissions of the "<strong>app/logs/</strong>" directory so that the web server can write into it.');
     $this->addPhpIniRequirement('date.timezone', true, false, 'date.timezone setting must be set', 'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).');
     $this->addRequirement(function_exists('json_encode'), 'json_encode() must be available', 'Install and enable the <strong>JSON</strong> extension.');
     $this->addRequirement(function_exists('session_start'), 'session_start() must be available', 'Install and enable the <strong>session</strong> extension.');
     $this->addRequirement(function_exists('ctype_alpha'), 'ctype_alpha() must be available', 'Install and enable the <strong>ctype</strong> extension.');
     $this->addRequirement(function_exists('token_get_all'), 'token_get_all() must be available', 'Install and enable the <strong>Tokenizer</strong> extension.');
     $this->addRequirement(function_exists('simplexml_import_dom'), 'simplexml_import_dom() must be available', 'Install and enable the <strong>SimpleXML</strong> extension.');
     $this->addRequirement(!(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='), 'APC version must be at least 3.0.17', 'Upgrade your <strong>APC</strong> extension (3.0.17+)');
     $this->addPhpIniRequirement('detect_unicode', false);
     $this->addPhpIniRequirement('suhosin.executor.include.whitelist', create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), true, 'suhosin.executor.include.whitelist must be configured correctly in php.ini', 'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.');
     $pcreVersion = defined('PCRE_VERSION') ? (double) PCRE_VERSION : null;
     $this->addRequirement(null !== $pcreVersion && $pcreVersion > 8.0, sprintf('PCRE extension must be available and at least 8.0 (%s installed)', $pcreVersion ? $pcreVersion : 'not'), 'Upgrade your <strong>PCRE</strong> extension (8.0+)');
     /* optional recommendations follow */
     $this->addRecommendation(class_exists('DomDocument'), 'PHP-XML module should be installed', 'Install and enable the <strong>PHP-XML</strong> module.');
     $this->addRecommendation(function_exists('mb_strlen'), 'mb_strlen() should be available', 'Install and enable the <strong>mbstring</strong> extension.');
     $this->addRecommendation(function_exists('iconv'), 'iconv() should be available', 'Install and enable the <strong>iconv</strong> extension.');
     $this->addRecommendation(function_exists('utf8_decode'), 'utf8_decode() should be available', 'Install and enable the <strong>XML</strong> extension.');
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         $this->addRecommendation(function_exists('posix_isatty'), 'posix_isatty() should be available', 'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).');
     }
     $this->addRecommendation(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension (used for validators).');
     if (class_exists('Locale')) {
         if (defined('INTL_ICU_VERSION')) {
             $version = INTL_ICU_VERSION;
         } else {
             $reflector = new ReflectionExtension('intl');
             ob_start();
             $reflector->info();
             $output = strip_tags(ob_get_clean());
             preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
             $version = $matches[1];
         }
         $this->addRecommendation(version_compare($version, '4.0', '>='), 'intl ICU version should be at least 4+', 'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).');
     }
     $accelerator = function_exists('apc_store') && ini_get('apc.enabled') || function_exists('eaccelerator_put') && ini_get('eaccelerator.enable') || function_exists('xcache_set');
     $this->addRecommendation($accelerator, 'a PHP accelerator should be installed', 'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).');
     $this->addPhpIniRecommendation('short_open_tag', false);
     $this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
     $this->addPhpIniRecommendation('register_globals', false, true);
     $this->addPhpIniRecommendation('session.auto_start', false);
     $this->addRecommendation(class_exists('PDO'), 'PDO should be installed', 'Install <strong>PDO</strong> (mandatory for Doctrine).');
     if (class_exists('PDO')) {
         $drivers = PDO::getAvailableDrivers();
         $this->addRecommendation(count($drivers), sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), 'Install <strong>PDO drivers</strong> (mandatory for Doctrine).');
     }
 }
开发者ID:royalwang,项目名称:license-manager-1,代码行数:57,代码来源:SymfonyRequirements.php

示例11: checkOptionalSettings

 /**
  * {@inheritdoc}
  */
 public function checkOptionalSettings()
 {
     $phpSupportData = array('5.3' => array('security' => '2013-07-11', 'eos' => '2014-08-14'), '5.4' => array('security' => '2014-09-14', 'eos' => '2015-09-14'), '5.5' => array('security' => '2015-07-10', 'eos' => '2016-07-10'), '5.6' => array('security' => '2016-08-28', 'eos' => '2017-08-28'));
     $messages = array();
     // Check the PHP version's support status
     $activePhpVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;
     // Do we have the PHP version's data?
     if (isset($phpSupportData[$activePhpVersion])) {
         // First check if the version has reached end of support
         $today = new \DateTime();
         $phpEndOfSupport = new \DateTime($phpSupportData[$activePhpVersion]['eos']);
         if ($phpNotSupported = $today > $phpEndOfSupport) {
             $messages[] = 'mautic.install.php.version.not.supported';
         }
         // If the version is still supported, check if it has reached security support only
         $phpSecurityOnlyDate = new \DateTime($phpSupportData[$activePhpVersion]['security']);
         if (!$phpNotSupported && $today > $phpSecurityOnlyDate) {
             $messages[] = 'mautic.install.php.version.has.only.security.support';
         }
     }
     if (version_compare(PHP_VERSION, '5.3.8', '<')) {
         $messages[] = 'mautic.install.php.version.annotations';
     }
     if (version_compare(PHP_VERSION, '5.4.0', '=')) {
         $messages[] = 'mautic.install.php.version.dump';
     }
     if (PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 18 || PHP_MINOR_VERSION == 4 && PHP_RELEASE_VERSION < 8) {
         $messages[] = 'mautic.install.php.version.pretty.error';
     }
     $pcreVersion = defined('PCRE_VERSION') ? (double) PCRE_VERSION : null;
     if (!is_null($pcreVersion)) {
         if (version_compare($pcreVersion, '8.0', '<')) {
             $messages[] = 'mautic.install.pcre.version';
         }
     }
     if (extension_loaded('xdebug')) {
         $cfgValue = ini_get('xdebug.max_nesting_level');
         if (!call_user_func(create_function('$cfgValue', 'return $cfgValue > 100;'), $cfgValue)) {
             $messages[] = 'mautic.install.xdebug.nesting';
         }
     }
     // We set a default timezone in the app bootstrap, but advise the user if their PHP config is missing it
     if (!ini_get('date.timezone')) {
         $messages[] = 'mautic.install.date.timezone.not.set';
     }
     if (!class_exists('\\DomDocument')) {
         $messages[] = 'mautic.install.module.phpxml';
     }
     if (!function_exists('mb_strlen')) {
         $messages[] = 'mautic.install.function.mbstring';
     }
     if (!function_exists('iconv')) {
         $messages[] = 'mautic.install.function.iconv';
     }
     if (!function_exists('utf8_decode')) {
         $messages[] = 'mautic.install.function.xml';
     }
     if (function_exists('imap_open')) {
         $messages[] = 'mautic.install.extension.imap';
     }
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         if (!function_exists('posix_isatty')) {
             $messages[] = 'mautic.install.function.posix';
         }
     }
     if (!class_exists('\\Locale')) {
         $messages[] = 'mautic.install.module.intl';
     }
     if (class_exists('\\Collator')) {
         try {
             if (is_null(new \Collator('fr_FR'))) {
                 $messages[] = 'mautic.install.intl.config';
             }
         } catch (\Exception $exception) {
             $messages[] = 'mautic.install.intl.config';
         }
     }
     if (class_exists('\\Locale')) {
         if (defined('INTL_ICU_VERSION')) {
             $version = INTL_ICU_VERSION;
         } else {
             try {
                 $reflector = new \ReflectionExtension('intl');
                 ob_start();
                 $reflector->info();
                 $output = strip_tags(ob_get_clean());
                 preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
                 $version = $matches[1];
             } catch (\ReflectionException $exception) {
                 $messages[] = 'mautic.install.module.intl';
                 // Fake the version here for the next check
                 $version = '4.0';
             }
         }
         if (version_compare($version, '4.0', '<')) {
             $messages[] = 'mautic.install.intl.icu.version';
         }
//.........这里部分代码省略.........
开发者ID:smotalima,项目名称:mautic,代码行数:101,代码来源:CheckStep.php

示例12: checkOptionalSettings

 /**
  * {@inheritdoc}
  */
 public function checkOptionalSettings()
 {
     $messages = [];
     $pcreVersion = defined('PCRE_VERSION') ? (double) PCRE_VERSION : null;
     if (!is_null($pcreVersion)) {
         if (version_compare($pcreVersion, '8.0', '<')) {
             $messages[] = 'mautic.install.pcre.version';
         }
     }
     if (extension_loaded('xdebug')) {
         $cfgValue = ini_get('xdebug.max_nesting_level');
         if (!call_user_func(create_function('$cfgValue', 'return $cfgValue > 100;'), $cfgValue)) {
             $messages[] = 'mautic.install.xdebug.nesting';
         }
     }
     if (!extension_loaded('zip')) {
         $messages[] = 'mautic.install.extension.zip';
     }
     // We set a default timezone in the app bootstrap, but advise the user if their PHP config is missing it
     if (!ini_get('date.timezone')) {
         $messages[] = 'mautic.install.date.timezone.not.set';
     }
     if (!class_exists('\\DomDocument')) {
         $messages[] = 'mautic.install.module.phpxml';
     }
     if (!function_exists('iconv')) {
         $messages[] = 'mautic.install.function.iconv';
     }
     if (!function_exists('utf8_decode')) {
         $messages[] = 'mautic.install.function.xml';
     }
     if (!function_exists('imap_open')) {
         $messages[] = 'mautic.install.extension.imap';
     }
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         if (!function_exists('posix_isatty')) {
             $messages[] = 'mautic.install.function.posix';
         }
     }
     $memoryLimit = $this->toBytes(ini_get('memory_limit'));
     $suggestedLimit = 128 * 1024 * 1024;
     if ($memoryLimit < $suggestedLimit) {
         $messages[] = 'mautic.install.memory.limit';
     }
     if (!class_exists('\\Locale')) {
         $messages[] = 'mautic.install.module.intl';
     }
     if (class_exists('\\Collator')) {
         try {
             if (is_null(new \Collator('fr_FR'))) {
                 $messages[] = 'mautic.install.intl.config';
             }
         } catch (\Exception $exception) {
             $messages[] = 'mautic.install.intl.config';
         }
     }
     if (class_exists('\\Locale')) {
         if (defined('INTL_ICU_VERSION')) {
             $version = INTL_ICU_VERSION;
         } else {
             try {
                 $reflector = new \ReflectionExtension('intl');
                 ob_start();
                 $reflector->info();
                 $output = strip_tags(ob_get_clean());
                 preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
                 $version = $matches[1];
             } catch (\ReflectionException $exception) {
                 $messages[] = 'mautic.install.module.intl';
                 // Fake the version here for the next check
                 $version = '4.0';
             }
         }
         if (version_compare($version, '4.0', '<')) {
             $messages[] = 'mautic.install.intl.icu.version';
         }
     }
     return $messages;
 }
开发者ID:Yame-,项目名称:mautic,代码行数:82,代码来源:CheckStep.php

示例13: ReflectionExtension

<?php

$obj = new ReflectionExtension('reflection');
ob_start();
$testa = $obj->info();
$testb = ob_get_clean();
var_dump($testa);
var_dump(strlen($testb) > 24);
?>
==DONE==
开发者ID:badlamer,项目名称:hhvm,代码行数:10,代码来源:ReflectionExtension_info_basic.php

示例14: getVersionICU

 /**
  * @return float
  * @throws CM_Exception
  */
 public static function getVersionICU()
 {
     $ext = new ReflectionExtension('intl');
     ob_start();
     $ext->info();
     $info = ob_get_clean();
     if (!preg_match('#^ICU version => ([\\d\\.]+)$#um', $info, $matches)) {
         throw new CM_Exception('Cannot detect ICU version', null, ['info' => $info]);
     }
     return (double) $matches[1];
 }
开发者ID:cargomedia,项目名称:cm,代码行数:15,代码来源:TH.php

示例15: initialize

 protected function initialize()
 {
     parent::initialize();
     $versionParser = new VersionParser();
     try {
         $prettyVersion = PHP_VERSION;
         $version = $versionParser->normalize($prettyVersion);
     } catch (\UnexpectedValueException $e) {
         $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
         $version = $versionParser->normalize($prettyVersion);
     }
     $php = new CompletePackage('php', $version, $prettyVersion);
     $php->setDescription('The PHP interpreter');
     parent::addPackage($php);
     if (PHP_INT_SIZE === 8) {
         $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
         $php64->setDescription('The PHP interpreter (64bit)');
         parent::addPackage($php64);
     }
     $loadedExtensions = get_loaded_extensions();
     // Extensions scanning
     foreach ($loadedExtensions as $name) {
         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';
             $version = $versionParser->normalize($prettyVersion);
         }
         $ext = new CompletePackage('ext-' . $name, $version, $prettyVersion);
         $ext->setDescription('The ' . $name . ' PHP extension');
         parent::addPackage($ext);
     }
     // Another quick loop, just for possible libraries
     // 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();
                 $prettyVersion = $curlVersion['version'];
                 break;
             case 'iconv':
                 $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;
             case 'openssl':
                 $prettyVersion = preg_replace_callback('{^(?:OpenSSL\\s*)?([0-9.]+)([a-z]?).*}', function ($match) {
                     return $match[1] . (empty($match[2]) ? '' : '.' . (ord($match[2]) - 96));
                 }, OPENSSL_VERSION_TEXT);
                 break;
             case 'pcre':
                 $prettyVersion = preg_replace('{^(\\S+).*}', '$1', PCRE_VERSION);
                 break;
             case 'uuid':
                 $prettyVersion = phpversion('uuid');
                 break;
             case 'xsl':
                 $prettyVersion = LIBXSLT_DOTTED_VERSION;
                 break;
             default:
                 // None handled extensions have no special cases, skip
                 continue 2;
         }
         try {
             $version = $versionParser->normalize($prettyVersion);
         } catch (\UnexpectedValueException $e) {
             continue;
         }
         $lib = new CompletePackage('lib-' . $name, $version, $prettyVersion);
         $lib->setDescription('The ' . $name . ' PHP library');
         parent::addPackage($lib);
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:94,代码来源:PlatformRepository.php


注:本文中的ReflectionExtension::info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。