本文整理汇总了PHP中ReflectionExtension类的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionExtension类的具体用法?PHP ReflectionExtension怎么用?PHP ReflectionExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReflectionExtension类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getTagsForExtension
/**
* @return array
*/
protected function getTagsForExtension($name)
{
if (!extension_loaded($name)) {
return array();
}
$tags = array();
$module = new \ReflectionExtension($name);
// Export constants.
foreach ($module->getConstants() as $name => $value) {
$tags[] = new Tag($name, 'constant', Tag::DEFINITION);
}
// Export functions.
foreach ($module->getFunctions() as $function) {
$tags[] = new Tag($function->getName(), 'function', TAG::DEFINITION);
}
// Export classes.
foreach ($module->getClasses() as $class) {
$tags[] = new Tag($class->getName(), 'class', TAG::DEFINITION);
foreach ($class->getMethods() as $method) {
$tags[] = new Tag(sprintf('%s::%s', $class->getName(), $method->getName()), 'function', TAG::DEFINITION);
}
foreach ($class->getProperties() as $property) {
$tags[] = new Tag(sprintf('%s::%s', $class->getName(), $property->getName()), 'variable', TAG::DEFINITION);
}
foreach ($class->getConstants() as $constant => $value) {
$tags[] = new Tag(sprintf('%s::%s', $class->getName(), $constant), 'constant', TAG::DEFINITION);
}
}
return $tags;
}
开发者ID:hexmode,项目名称:phptags,代码行数:33,代码来源:ExtensionTags.php
示例2: prepare_storage
public function prepare_storage()
{
// Generate tables
midgard_storage::create_base_storage();
// And update as necessary
$re = new ReflectionExtension('midgard2');
$classes = $re->getClasses();
foreach ($classes as $refclass) {
if ($refclass->isAbstract() || $refclass->isInterface()) {
continue;
}
$type = $refclass->getName();
if (!is_subclass_of($type, 'MidgardDBObject')) {
continue;
}
if (midgard_storage::class_storage_exists($type)) {
// FIXME: Skip updates until http://trac.midgard-project.org/ticket/1426 is fixed
continue;
if (!midgard_storage::update_class_storage($type)) {
$this->markTestSkipped('Could not update ' . $type . ' tables in test database');
}
continue;
}
if (!midgard_storage::create_class_storage($type)) {
$this->markTestSkipped('Could not create ' . $type . ' tables in test database');
}
}
// And update as necessary
return;
if (!midgard_user::auth('root', 'password')) {
echo "auth failed\n";
$this->markTestSkipped('Could not authenticate as ROOT');
}
}
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:34,代码来源:midgard.php
示例3: 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
示例4: 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
示例5: testExtension
public function testExtension()
{
if (!extension_loaded('hstore')) {
return;
}
$r = new \ReflectionExtension('hstore');
$this->assertContains('Intaro\\HStore\\Coder', $r->getClassNames());
}
开发者ID:intaro,项目名称:hstore-extension,代码行数:8,代码来源:CoderTest.php
示例6: __construct
public function __construct()
{
parent::__construct();
foreach (get_loaded_extensions() as $ext) {
$re = new \ReflectionExtension($ext);
$extensions = $this->append(NULL, array($ext, $re));
$this->addFunctions($extensions, $re->getFunctions());
$this->addClasses($extensions, $re->getClasses());
}
}
开发者ID:johannes,项目名称:php-explorer,代码行数:10,代码来源:ExtensionTree.php
示例7: 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
示例8: __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
示例9: __invoke
/**
* @param string[] $extensionNames
* @return string[]
* @throws UnknownExtensionException if the extension cannot be found
*/
public function __invoke(array $extensionNames) : array
{
$definedSymbols = [];
foreach ($extensionNames as $extensionName) {
try {
$extensionReflection = new \ReflectionExtension($extensionName);
$definedSymbols = array_merge($definedSymbols, array_keys($extensionReflection->getConstants()), array_keys($extensionReflection->getFunctions()), $extensionReflection->getClassNames());
} catch (\Exception $e) {
throw new UnknownExtensionException($e->getMessage());
}
}
return $definedSymbols;
}
开发者ID:pamil,项目名称:ComposerRequireChecker,代码行数:18,代码来源:LocateDefinedSymbolsFromExtensions.php
示例10: __construct
function __construct(SymbolTable $symbolTable, \Guardrail\Output\OutputInterface $output)
{
parent::__construct($symbolTable, $output);
foreach (get_loaded_extensions() as $extension) {
try {
$reflectedExtension = new \ReflectionExtension($extension);
foreach ($reflectedExtension->getConstants() as $constant => $value) {
$this->reflectedConstants[$constant] = true;
}
} catch (\ReflectionException $e) {
}
}
}
开发者ID:jongardiner,项目名称:StaticAnalysis,代码行数:13,代码来源:DefinedConstantCheck.php
示例11: 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
示例12: mustHaveExtension
private static function mustHaveExtension($ext)
{
if (!extension_loaded($ext)) {
echo "ERROR: The PHP extension '{$ext}' is not installed. You must " . "install it to run aphlict on this machine.\n";
exit(1);
}
$extension = new ReflectionExtension($ext);
foreach ($extension->getFunctions() as $function) {
$function = $function->name;
if (!function_exists($function)) {
echo "ERROR: The PHP function {$function}() is disabled. You must " . "enable it to run aphlict on this machine.\n";
exit(1);
}
}
}
开发者ID:denghp,项目名称:phabricator,代码行数:15,代码来源:PhabricatorAphlictManagementWorkflow.php
示例13: mustHaveExtension
private static function mustHaveExtension($ext)
{
if (!extension_loaded($ext)) {
echo pht("ERROR: The PHP extension '%s' is not installed. You must " . "install it to run Aphlict on this machine.", $ext) . "\n";
exit(1);
}
$extension = new ReflectionExtension($ext);
foreach ($extension->getFunctions() as $function) {
$function = $function->name;
if (!function_exists($function)) {
echo pht('ERROR: The PHP function %s is disabled. You must ' . 'enable it to run Aphlict on this machine.', $function . '()') . "\n";
exit(1);
}
}
}
开发者ID:fengshao0907,项目名称:phabricator,代码行数:15,代码来源:PhabricatorAphlictManagementWorkflow.php
示例14: 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
示例15: expectArgumentError
function expectArgumentError($message)
{
try {
$extension = new \ReflectionExtension('functional');
$extensionFunctions = array_keys($extension->getFunctions());
$isDefinedInExtension = F\every($this->functions, function ($function) use($extensionFunctions) {
return in_array($function, $extensionFunctions, true);
});
if ($isDefinedInExtension) {
$this->setExpectedException('PHPUnit_Framework_Error_Warning', $message);
} else {
$this->setExpectedException('Functional\\Exceptions\\InvalidArgumentException', $message);
}
} catch (\ReflectionException $e) {
$this->setExpectedException('Functional\\Exceptions\\InvalidArgumentException', $message);
}
}
开发者ID:RightThisMinute,项目名称:responsive-images-php,代码行数:17,代码来源:AbstractTestCase.php
示例16: getTypes
private function getTypes()
{
$mgdschemas = array();
$re = new \ReflectionExtension('midgard2');
$classes = $re->getClasses();
foreach ($classes as $refclass) {
$parent_class = $refclass->getParentClass();
if (!$parent_class) {
continue;
}
if ($parent_class->getName() != 'midgard_object') {
continue;
}
$mgdschemas[$include_views][] = $refclass->getName();
}
return $mgdschemas;
}
开发者ID:rambo,项目名称:jackalope,代码行数:17,代码来源:Midgard2.php
示例17: 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
示例18: 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
示例19: get_mgdschema_classes
public function get_mgdschema_classes()
{
static $mgdschemas = array();
if (empty($mgdschemas)) {
// Get the classes from PHP5 reflection
$re = new ReflectionExtension('midgard2');
$classes = $re->getClasses();
foreach ($classes as $refclass) {
$parent_class = $refclass->getParentClass();
if (!$parent_class) {
continue;
}
if ($parent_class->getName() == 'midgard_object') {
$mgdschemas[] = $refclass->getName();
}
}
}
return $mgdschemas;
}
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:19,代码来源:mjolnir.php
示例20: introspect
public function introspect(\ReflectionExtension $extension)
{
$classes = $functions = $constants = array();
foreach ($extension->getClasses() as $class) {
assert($class instanceof \ReflectionClass);
$phpClass = PhpClass::fromReflection($class);
$classes[] = $phpClass;
}
foreach ($extension->getFunctions() as $function) {
assert($function instanceof \ReflectionFunction);
$phpFunction = PhpFunction::fromReflection($function);
$functions[] = $phpFunction;
}
foreach ($extension->getConstants() as $name => $value) {
$phpConstant = new PhpConstant($name);
$phpConstant->setValue($value);
$constants[] = $phpConstant;
}
return array('classes' => $classes, 'functions' => $functions, 'constants' => $constants);
}
开发者ID:norrs,项目名称:php-stubs,代码行数:20,代码来源:ExtensionIntrospector.php
注:本文中的ReflectionExtension类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论