本文整理汇总了PHP中ReflectionExtension::getClassNames方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionExtension::getClassNames方法的具体用法?PHP ReflectionExtension::getClassNames怎么用?PHP ReflectionExtension::getClassNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionExtension
的用法示例。
在下文中一共展示了ReflectionExtension::getClassNames方法的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);
}
}
示例2: testExtension
public function testExtension()
{
if (!extension_loaded('hstore')) {
return;
}
$r = new \ReflectionExtension('hstore');
$this->assertContains('Intaro\\HStore\\Coder', $r->getClassNames());
}
示例3: getClasses
public function getClasses()
{
$res = [];
foreach (parent::getClassNames() as $val) {
$res[$val] = new ClassType($val);
}
return $res;
}
示例4: getClassNames
/**
* Returns an array containing all names of all classes of this extension
* @return string[]
*/
public function getClassNames()
{
if ($this->reflectionSource) {
return $this->reflectionSource->getClassNames();
} else {
return parent::getClassNames();
}
}
示例5: getClasses
public function getClasses()
{
$res = array();
foreach (parent::getClassNames() as $val) {
$res[$val] = new ClassReflection($val);
}
return $res;
}
示例6: __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;
}
示例7: getDefaultColophons
/**
* Returns default colophons.
* @param string profiler | bluescreen
* @return array
*/
public static function getDefaultColophons($sender)
{
if ($sender === 'profiler') {
$arr[] = 'Elapsed time: ' . sprintf('%0.3f', (microtime(TRUE) - Debug::$time) * 1000) . ' ms';
foreach ((array) self::$counters as $name => $value) {
if (is_array($value)) {
$value = implode(', ', $value);
}
$arr[] = htmlSpecialChars($name) . ' = <strong>' . htmlSpecialChars($value) . '</strong>';
}
$autoloaded = class_exists('AutoLoader', FALSE) ? AutoLoader::$count : 0;
$s = '<span>' . count(get_included_files()) . '/' . $autoloaded . ' files</span>, ';
$exclude = array('stdClass', 'Exception', 'ErrorException', 'Traversable', 'IteratorAggregate', 'Iterator', 'ArrayAccess', 'Serializable', 'Closure');
foreach (get_loaded_extensions() as $ext) {
$ref = new ReflectionExtension($ext);
$exclude = array_merge($exclude, $ref->getClassNames());
}
$classes = array_diff(get_declared_classes(), $exclude);
$intf = array_diff(get_declared_interfaces(), $exclude);
$func = get_defined_functions();
$func = (array) @$func['user'];
$consts = get_defined_constants(TRUE);
$consts = array_keys((array) @$consts['user']);
foreach (array('classes', 'intf', 'func', 'consts') as $item) {
$s .= '<span ' . (${$item} ? 'title="' . implode(", ", ${$item}) . '"' : '') . '>' . count(${$item}) . ' ' . $item . '</span>, ';
}
$arr[] = $s;
}
if ($sender === 'bluescreen') {
$arr[] = 'PHP ' . PHP_VERSION;
if (isset($_SERVER['SERVER_SOFTWARE'])) {
$arr[] = htmlSpecialChars($_SERVER['SERVER_SOFTWARE']);
}
//$arr[] = 'Nette Framework ' . Framework::VERSION . ' (revision ' . Framework::REVISION . ')';
$arr[] = 'Report generated at ' . @strftime('%c', Debug::$time);
// intentionally @
}
return $arr;
}
示例8: ReflectionExtension
<?php
$ereg = new ReflectionExtension('ereg');
var_dump($ereg->getClassNames());
?>
==DONE==
示例9: ReflectionExtension
<?php
$extension = new ReflectionExtension('ctype');
var_dump($extension->getClassNames());
?>
==DONE==
开发者ID:gleamingthecube,项目名称:php,代码行数:6,代码来源:ext_reflection_tests_ReflectionExtension_getClassNames_variation1.php
示例10: _getExtension
/**
* Get all info about function
* @param string|function $extensionName Function or function name
* @return array|bool
*/
protected static function _getExtension($extensionName)
{
if (!extension_loaded($extensionName)) {
return false;
}
$ext = new ReflectionExtension($extensionName);
$result = array();
$result['name'] = $ext->name;
$result['version'] = $ext->getVersion();
if ($constants = $ext->getConstants()) {
$result['constants'] = $constants;
}
if ($classesName = $ext->getClassNames()) {
$result['classesName'] = $classesName;
}
if ($functions = $ext->getFunctions()) {
$result['functions'] = $functions;
}
if ($dependencies = $ext->getDependencies()) {
$result['dependencies'] = $dependencies;
}
if ($INIEntries = $ext->getINIEntries()) {
$result['INIEntries'] = $INIEntries;
}
$functions = $ext->getFunctions();
if (is_array($functions) && count($functions) > 0) {
$result['functions'] = array();
foreach ($functions as $function) {
$funcName = $function->getName();
$result['functions'][$funcName] = self::_getFunction($funcName);
}
}
return $result;
}
示例11: _initTypeToExtension
/**
* This method reads all available classes and interfaces and checks whether
* this type belongs to an extension or is internal. All internal and extension
* classes are collected in an internal data structure.
*
* @return array(string=>string)
*/
private static function _initTypeToExtension()
{
// Skip when already done.
if (self::$_typeNameToExtension !== null) {
return self::$_typeNameToExtension;
}
self::$_typeNameToExtension = array('iterator' => '+standard');
$extensionNames = get_loaded_extensions();
$extensionNames = array_map('strtolower', $extensionNames);
foreach ($extensionNames as $extensionName) {
$extension = new ReflectionExtension($extensionName);
$classNames = $extension->getClassNames();
$classNames = array_map('strtolower', $classNames);
foreach ($classNames as $className) {
self::$_typeNameToExtension[$className] = '+' . $extensionName;
}
}
return self::$_typeNameToExtension;
}
示例12: ReflectionExtension
<pre>
<?php
// Создание экземпляра класса ReflectionProperty
$ext = new ReflectionExtension('standard');
// Вывод основной информации
printf("Имя : %s\n" . "Версия : %s\n" . "Функции : [%d] %s\n" . "Константы : [%d] %s\n" . "Директивы INI : [%d] %s\n" . "Классы : [%d] %s\n", $ext->getName(), $ext->getVersion() ? $ext->getVersion() : 'NO_VERSION', sizeof($ext->getFunctions()), var_export($ext->getFunctions(), 1), sizeof($ext->getConstants()), var_export($ext->getConstants(), 1), sizeof($ext->getINIEntries()), var_export($ext->getINIEntries(), 1), sizeof($ext->getClassNames()), var_export($ext->getClassNames(), 1));
?>
</pre>
示例13: ListPackage
public static function ListPackage()
{
foreach (get_loaded_extensions() as $ext) {
$reflection = new ReflectionExtension($ext);
foreach ($reflection->getClassNames() as $class) {
echo $reflection->getName() . ': ' . $class . "\n";
}
}
}
示例14: testGetClassesFromExtension
/**
* Test that each classes are defined in reference
*
* @depends testReference
* @group reference
* @return void
*/
public function testGetClassesFromExtension()
{
if (is_null($this->ref)) {
return;
}
foreach ($this->ref['extensions'] as $extname => $opt) {
if ('internal' == $extname) {
// only Core is a valid extension name for API reflection
continue;
}
$extension = new ReflectionExtension($extname);
$classes = $extension->getClassNames();
foreach ($classes as $classname) {
if (class_exists($classname)) {
if (!in_array($classname, $this->ignoredclasses)) {
$this->assertArrayHasKey($classname, $this->ref['classes'], "Defined class '{$classname}' not known in Reference.");
}
} else {
if (!in_array($classname, $this->ignoredinterfaces)) {
$this->assertArrayHasKey($classname, $this->ref['interfaces'], "Defined interface '{$classname}' not known in Reference.");
}
}
}
}
}
示例15:
__toString(){return'Extension '.$this->getName();}function
getClasses(){$res=array();foreach(parent::getClassNames()as$val){$res[$val]=new
ClassType($val);}return$res;}function