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


PHP ReflectionExtension::getVersion方法代码示例

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


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

示例1: _generateFileStructure

 /**
  * @return void
  */
 protected function _generateFileStructure()
 {
     $classes = $this->_extension->getClassNames();
     foreach ($classes as $class) {
         $reflectionClass = new \ReflectionClass($class);
         $output = "<?php\n\n";
         $output .= $this->_exportNamespace($reflectionClass);
         $output .= $this->_exportDefinition($reflectionClass);
         $output .= "\n{\n\n";
         $output .= $this->_exportClassConstants($reflectionClass);
         $output .= $this->_exportClassProperties($reflectionClass);
         $output .= $this->_exportClassMethods($reflectionClass);
         $output .= "}";
         $dir_class = str_replace('\\', DIRECTORY_SEPARATOR, $reflectionClass->getNamespaceName());
         $dir = $this->_targetDir . DIRECTORY_SEPARATOR . $this->_extension->getVersion() . DIRECTORY_SEPARATOR . $dir_class;
         if (!is_dir($dir)) {
             mkdir($dir, 0777, true);
         }
         $file = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
         $path = $this->_targetDir . DIRECTORY_SEPARATOR . $this->_extension->getVersion() . DIRECTORY_SEPARATOR . $file;
         $fp = fopen($path, 'w+');
         fputs($fp, $output);
         fclose($fp);
     }
 }
开发者ID:niden,项目名称:phalcon-devtools,代码行数:28,代码来源:Stub.php

示例2: 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 MemoryPackage('php', $version, $prettyVersion);
     $php->setDescription('The PHP interpreter');
     parent::addPackage($php);
     foreach (get_loaded_extensions() 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 MemoryPackage('ext-' . $name, $version, $prettyVersion);
         $ext->setDescription('The ' . $name . ' PHP extension');
         parent::addPackage($ext);
     }
 }
开发者ID:nlegoff,项目名称:composer,代码行数:31,代码来源:PlatformRepository.php

示例3: welcomeOp

 /**
  * 欢迎页面
  */
 public function welcomeOp()
 {
     /**
      * 管理员信息
      */
     $model_admin = Model('admin');
     $tmp = $this->getAdminInfo();
     $condition['admin_id'] = $tmp['id'];
     $admin_info = $model_admin->infoAdmin($condition);
     $admin_info['admin_login_time'] = date('Y-m-d H:i:s', $admin_info['admin_login_time'] == '' ? time() : $admin_info['admin_login_time']);
     /**
      * 系统信息
      */
     $version = C('version');
     $setup_date = C('setup_date');
     $statistics['os'] = PHP_OS;
     $statistics['web_server'] = $_SERVER['SERVER_SOFTWARE'];
     $statistics['php_version'] = PHP_VERSION;
     $statistics['sql_version'] = Db::getServerInfo();
     $statistics['shop_version'] = $version;
     $statistics['setup_date'] = substr($setup_date, 0, 10);
     // 运维舫 c extension
     try {
         $r = new ReflectionExtension('shopnc');
         $statistics['php_version'] .= ' / ' . $r->getVersion();
     } catch (ReflectionException $ex) {
     }
     Tpl::output('statistics', $statistics);
     Tpl::output('admin_info', $admin_info);
     Tpl::showpage('welcome');
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:34,代码来源:dashboard.php

示例4: ReflectionExtension

 function __construct()
 {
     if (!extension_loaded(self::EXTENSION_NAME)) {
         throw new \Exception("no " . self::EXTENSION_NAME . " extension.");
     }
     $this->rf_ext = new ReflectionExtension(self::EXTENSION_NAME);
     $this->version = $this->rf_ext->getVersion();
 }
开发者ID:google2013,项目名称:swoole-src,代码行数:8,代码来源:dump.php

示例5: getVersion

 /**
  * Returns this extension's version
  * @return string
  */
 public function getVersion()
 {
     if ($this->reflectionSource) {
         return $this->reflectionSource->getVersion();
     } else {
         return parent::getVersion();
     }
 }
开发者ID:naderman,项目名称:pflow,代码行数:12,代码来源:extension.php

示例6: tExtension

 public static function tExtension($test, $ext)
 {
     try {
         $ref = new ReflectionExtension($ext);
         $v = $ref->getVersion();
         self::setTestData($test, '%s found%s', $ref->getName(), $v ? ' v' . $v : '');
         return true;
     } catch (ReflectionException $e) {
         self::setTestData($test, $e->getMessage());
     }
     return false;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:12,代码来源:testdeps.php

示例7: __construct

 /**
  * Constructor.
  */
 protected function __construct()
 {
     $this->memcached = new \Memcached();
     $this->memcached->addServer(Config::getCacheHost(), Config::getCachePort());
     $this->memcached->setOption(\Memcached::OPT_PREFIX_KEY, Config::getCachePrefix());
     //determine if deleteMulti() is supported
     if (defined('HHVM_VERSION')) {
         $this->hasMultiDelete = false;
     } else {
         $ext = new \ReflectionExtension('memcached');
         $this->hasMultiDelete = version_compare($ext->getVersion(), '2.0.0', '>=');
     }
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:16,代码来源:MemcachedWrapper.php

示例8: opcodeCacheData

 /**
  * @return array
  */
 public function opcodeCacheData()
 {
     $cacheData = array();
     foreach (static::$opcacheExtenstions as $name => $data) {
         list($title, $iniSetting) = $data;
         if ($this->hasCache($name, $iniSetting)) {
             $cacheData['title'] = $title;
             $cacheData['name'] = $name;
             $ref = new \ReflectionExtension($name);
             $cacheData['version'] = $ref->getVersion();
             $cacheData['settings'] = $ref->getINIEntries();
             break;
         }
     }
     return $cacheData;
 }
开发者ID:nicmart,项目名称:benchmark,代码行数:19,代码来源:MachineData.php

示例9: export_ext

function export_ext($ext)
{
    $rf_ext = new ReflectionExtension($ext);
    $funcs = $rf_ext->getFunctions();
    $classes = $rf_ext->getClasses();
    $consts = $rf_ext->getConstants();
    $version = $rf_ext->getVersion();
    $defines = '';
    $sp4 = str_repeat(' ', 4);
    $fdefs = getFuncDef($funcs, $version);
    $class_def = '';
    foreach ($consts as $k => $v) {
        if (!is_numeric($v)) {
            $v = "'{$v}'";
        }
        $defines .= "define('{$k}',{$v});\n";
    }
    foreach ($classes as $k => $v) {
        $prop_str = '';
        $props = $v->getProperties();
        array_walk($props, function ($v, $k) {
            global $prop_str, $sp4;
            $modifiers = implode(' ', Reflection::getModifierNames($v->getModifiers()));
            $prop_str .= "{$sp4}/**\n{$sp4}*@var \$" . $v->name . " " . $v->class . "\n{$sp4}*/\n{$sp4} {$modifiers}  \$" . $v->name . ";\n\n";
        });
        if ($v->getParentClass()) {
            $k .= ' extends ' . $v->getParentClass()->name;
        }
        $modifier = 'class';
        if ($v->isInterface()) {
            $modifier = 'interface';
        }
        $mdefs = getMethodsDef($v->getMethods(), $version);
        $class_def .= sprintf("/**\n*@since %s\n*/\n%s %s{\n%s%s\n}\n", $version, $modifier, $k, $prop_str, $mdefs);
    }
    if (!file_exists('./ext')) {
        mkdir('./ext', 777, TRUE);
    }
    file_put_contents("./ext/" . $ext . ".php", "<?php\n" . $defines . $fdefs . $class_def);
}
开发者ID:CraryPrimitiveMan,项目名称:code-examples,代码行数:40,代码来源:getExtFuncs.php

示例10: 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

示例11: ReflectionExtension

<?php

$r = new ReflectionExtension("mysql");
printf("Name: %s\n", $r->name);
printf("Version: %s\n", $r->getVersion());
$classes = $r->getClasses();
if (!empty($classes)) {
    printf("[002] Expecting no class\n");
    asort($classes);
    var_dump($classes);
}
$ignore = array();
$functions = $r->getFunctions();
asort($functions);
printf("Functions:\n");
foreach ($functions as $func) {
    if (isset($ignore[$func->name])) {
        unset($ignore[$func->name]);
    } else {
        printf("  %s\n", $func->name);
    }
}
if (!empty($ignore)) {
    printf("Dumping version dependent and missing functions\n");
    var_dump($ignore);
}
print "done!";
开发者ID:badlamer,项目名称:hhvm,代码行数:27,代码来源:mysql_reflection_extension.php

示例12: check

 echo "Environment Check{$n}";
 echo "-----------------{$n}{$n}";
 echo "\"-\" indicates success.{$n}";
 echo "\"*\" indicates error.{$n}{$n}";
 // check version
 check('You have a supported version of PHP (>= 5.3.3).', 'You need PHP 5.3.3 or greater.', function () {
     return version_compare(PHP_VERSION, '5.3.3', '>=');
 });
 // check phar extension
 check('You have the "phar" extension installed.', 'You need to have the "phar" extension installed.', function () {
     return extension_loaded('phar');
 });
 // check phar extension version
 check('You have a supported version of the "phar" extension.', 'You need a newer version of the "phar" extension (>=2.0).', function () {
     $phar = new ReflectionExtension('phar');
     return version_compare($phar->getVersion(), '2.0', '>=');
 });
 // check openssl extension
 check('You have the "openssl" extension installed.', 'Notice: The "openssl" extension will be needed to sign with private keys.', function () {
     return extension_loaded('openssl');
 }, false);
 // check phar readonly setting
 check('The "phar.readonly" setting is off.', 'Notice: The "phar.readonly" setting needs to be off to create Phars.', function () {
     return false == ini_get('phar.readonly');
 }, false);
 // check detect unicode setting
 check('The "detect_unicode" setting is off.', 'The "detect_unicode" setting needs to be off.', function () {
     return false == ini_get('detect_unicode');
 });
 // check suhosin setting
 if (extension_loaded('suhosin')) {
开发者ID:chrisribe,项目名称:OpenTok-PHP-SDK,代码行数:31,代码来源:box-installer.php

示例13: checkZkState

 public function checkZkState()
 {
     /*{{{*/
     $ext = new ReflectionExtension('zookeeper');
     $ver = $ext->getVersion();
     if (version_compare($ver, '0.2.0') < 0) {
         //throw new LogConfException("Required version of extension($name) is at least $version_min!");
         return;
     }
     $state = getState($this->zkClient_);
     if (ZOK != $state) {
         throw new LogConfException("zookeeper connection state wrong: {$state}");
     }
 }
开发者ID:stgrandet,项目名称:logkafka,代码行数:14,代码来源:log_config.php

示例14: ReflectionExtension

--TEST--
Reflection Extension -> basic
--FILE--
<?php 
$r = new ReflectionExtension("core");
var_dump($r->getName());
var_dump($r->getVersion());
try {
    $r = new ReflectionExtension("unknown");
} catch (ReflectionException $e) {
    var_dump($e->getMessage());
}
?>
--EXPECTF--
string(4) "Core"
string(%d) "%d.%s
string(32) "Extension unknown does not exist"
开发者ID:lihuibin,项目名称:jphp,代码行数:17,代码来源:ReflectionExtension_001.php

示例15: loadModuleIfAbsent

 /**
  * Load PHP extension (module) if absent
  * @param string $mod
  * @param string $version
  * @param string $compare
  * @return bool $success
  */
 public static function loadModuleIfAbsent($mod, $version = null, $compare = '>=')
 {
     if (!extension_loaded($mod)) {
         if (!get_cfg_var('enable_dl')) {
             return false;
         }
         if (!@dl(basename($mod) . '.so')) {
             return false;
         }
     }
     if (!$version) {
         return true;
     }
     try {
         $ext = new \ReflectionExtension($mod);
         return version_compare($ext->getVersion(), $version, $compare);
     } catch (\ReflectionException $e) {
         return false;
     }
 }
开发者ID:aleksraiden,项目名称:phpdaemon-sockjs-example,代码行数:27,代码来源:Daemon.php


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