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


PHP ReflectionClass::getExtensionName方法代码示例

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


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

示例1: getExtension

 public function getExtension()
 {
     $extName = parent::getExtensionName();
     if ($extName) {
         return new MyReflectionExtension($extName);
     } else {
         return NULL;
     }
 }
开发者ID:zetacomponents,项目名称:reflection,代码行数:9,代码来源:MyReflectionClass.php

示例2: generateClass

 /**
  * Called for every reflected class, interface or trait
  *
  * @param \ReflectionClass $class
  * @param string $generated
  * @param $generated
  */
 public function generateClass(\ReflectionClass $class, $generated)
 {
     $this->addToExtension($class->getExtensionName(), $generated);
 }
开发者ID:mfn,项目名称:php-reflection-gen,代码行数:11,代码来源:Directory.php

示例3: _getClass

 /**
  * Get all info about class (object)
  * @param   string|object $data Object or class name
  * @return  JBDump
  */
 protected static function _getClass($data)
 {
     // check arg
     if (is_object($data)) {
         $className = get_class($data);
     } elseif (is_string($data)) {
         $className = $data;
     } else {
         return false;
     }
     if (!class_exists($className) && !interface_exists($className)) {
         return false;
     }
     // create ReflectionClass object
     $class = new ReflectionClass($data);
     // get basic class info
     $result['name'] = $class->name;
     $result['type'] = $class->isInterface() ? 'interface' : 'class';
     if ($classComment = $class->getDocComment()) {
         $result['comment'] = $classComment;
     }
     if ($classPath = $class->getFileName()) {
         $result['path'] = $classPath . ' ' . $class->getStartLine() . '/' . $class->getEndLine();
     }
     if ($classExtName = $class->getExtensionName()) {
         $result['extension'] = $classExtName;
     }
     if ($class->isAbstract()) {
         $result['abstract'] = true;
     }
     if ($class->isFinal()) {
         $result['final'] = true;
     }
     // get all parents of class
     $class_tmp = $class;
     $result['parents'] = array();
     while ($parent = $class_tmp->getParentClass()) {
         if (isset($parent->name)) {
             $result['parents'][] = $parent->name;
             $class_tmp = $parent;
         }
     }
     if (count($result['parents']) == 0) {
         unset($result['parents']);
     }
     // reflecting class interfaces
     $interfaces = $class->getInterfaces();
     if (is_array($interfaces)) {
         foreach ($interfaces as $property) {
             $result['interfaces'][] = $property->name;
         }
     }
     // reflection class constants
     $constants = $class->getConstants();
     if (is_array($constants)) {
         foreach ($constants as $key => $property) {
             $result['constants'][$key] = $property;
         }
     }
     // reflecting class properties
     $properties = $class->getProperties();
     if (is_array($properties)) {
         foreach ($properties as $key => $property) {
             if ($property->isPublic()) {
                 $visible = "public";
             } elseif ($property->isProtected()) {
                 $visible = "protected";
             } elseif ($property->isPrivate()) {
                 $visible = "private";
             } else {
                 $visible = "public";
             }
             $propertyName = $property->getName();
             $result['properties'][$visible][$propertyName]['comment'] = $property->getDocComment();
             $result['properties'][$visible][$propertyName]['static'] = $property->isStatic();
             $result['properties'][$visible][$propertyName]['default'] = $property->isDefault();
             $result['properties'][$visible][$propertyName]['class'] = $property->class;
         }
     }
     // get source
     $source = null;
     if (isset($result['path']) && $result['path']) {
         $source = @file($class->getFileName());
         if (!empty($source)) {
             $result['source::source'] = implode('', $source);
         }
     }
     // reflecting class methods
     foreach ($class->getMethods() as $key => $method) {
         if ($method->isPublic()) {
             $visible = "public";
         } elseif ($method->isProtected()) {
             $visible = "protected";
         } elseif ($method->isPrivate()) {
             $visible = "protected";
//.........这里部分代码省略.........
开发者ID:CB9TOIIIA,项目名称:JBDump,代码行数:101,代码来源:class.jbdump.php

示例4: initVersionCompatibility

 /**
  * There was an api change between PHP 5.3.0alpha3 and 5.3.0beta1, the new
  * extension name "Core" was introduced and interfaces like "Iterator" are
  * now part of "Core" instead of "Standard".
  *
  * @return void
  */
 private static function initVersionCompatibility()
 {
     $reflection = new ReflectionClass('Iterator');
     $extension = strtolower($reflection->getExtensionName());
     $extension = $extension === '' ? 'standard' : $extension;
     if (defined('CORE_PACKAGE') === false) {
         define('CORE_PACKAGE', '+' . $extension);
     }
 }
开发者ID:JohnMurray,项目名称:VulnScan,代码行数:16,代码来源:AbstractTest.php

示例5: _resolveDepend

 /**
  * Resolve depend from class
  * @param \ReflectionClass $class
  * @return EntityClass
  */
 private function _resolveDepend(\ReflectionClass $class)
 {
     if ($class->isInternal()) {
         $this->addDepends($class->getExtensionName());
         return new EntityClass($class->getName());
     } elseif (isset($this->classes[$class->getName()])) {
         return $this->classes[$class->getName()];
     } else {
         // todo: log the problem
         $file = $this->files[$class->getFileName()] = new EntityFile($class->getFileName(), $this);
         $file->scan();
         $this->_addEntities($file);
     }
 }
开发者ID:sergeyk-jomedia,项目名称:koda,代码行数:19,代码来源:Project.php

示例6: gen_docs

function gen_docs($name, $type)
{
    /* {{{ */
    global $OPTION, $INFO;
    if ($type & DOC_EXTENSION) {
        try {
            $extension = new ReflectionExtension($name);
            $INFO['actual_extension'] = $name;
            write_doc($extension, DOC_EXTENSION);
            foreach ($extension->getClasses() as $class) {
                gen_docs($class->name, DOC_CLASS);
            }
            foreach ($extension->getFunctions() as $function) {
                gen_docs($function->name, DOC_FUNCTION);
            }
        } catch (Exception $e) {
            die('Error: ' . $e->getMessage() . "\n");
        }
    } else {
        if ($type & DOC_FUNCTION) {
            try {
                $function = new ReflectionFunction($name);
                if (!$INFO['actual_extension']) {
                    if ($extname = $function->getExtensionName()) {
                        $INFO['actual_extension'] = $extname;
                    } else {
                        add_warning("The function {$name} lacks Reflection information");
                    }
                }
                write_doc($function, DOC_FUNCTION);
            } catch (Exception $e) {
                die('Error: ' . $e->getMessage() . "\n");
            }
        } else {
            if ($type & DOC_METHOD) {
                try {
                    $class = new ReflectionClass($OPTION['class']);
                    if (!$INFO['actual_extension']) {
                        if ($extname = $class->getExtensionName()) {
                            $INFO['actual_extension'] = $extname;
                        } else {
                            add_warning("The method {$name} lacks Reflection information");
                        }
                    }
                    foreach ($class->getMethods() as $method) {
                        /* Don't get the inherited methods */
                        if ($method->getDeclaringClass()->name == $class->name && (is_array($OPTION['method']) && in_array(strtolower($method->getName()), $OPTION['method']) || $OPTION['method'] == strtolower($method->getName()))) {
                            write_doc($method, $method->isConstructor() ? DOC_CONSTRUCTOR : DOC_METHOD);
                        }
                    }
                } catch (Exception $e) {
                    die('Error: ' . $e->getMessage() . "\n");
                }
            } else {
                if ($type & DOC_CLASS) {
                    try {
                        $class = new ReflectionClass($name);
                        if (!$INFO['actual_extension']) {
                            if ($extname = $class->getExtensionName()) {
                                $INFO['actual_extension'] = $extname;
                            } else {
                                add_warning("The class {$name} lacks Reflection information");
                            }
                        }
                        write_doc($class, DOC_CLASS);
                        foreach ($class->getMethods() as $method) {
                            /* Don't get the inherited methods */
                            if ($method->getDeclaringClass()->name == $class->name) {
                                write_doc($method, $method->isConstructor() ? DOC_CONSTRUCTOR : DOC_METHOD);
                            }
                        }
                    } catch (Exception $e) {
                        die('Error: ' . $e->getMessage() . "\n");
                    }
                }
            }
        }
    }
}
开发者ID:guoyu07,项目名称:NYAF,代码行数:79,代码来源:docgen.php

示例7: array

$err = 0;
$classes = array_merge(get_declared_classes(), get_declared_interfaces());
$extensions = array();
foreach (get_loaded_extensions() as $ext) {
    $cnt_modules++;
    if (strpos($ext, "_") !== false) {
        $err++;
        $extensions[$ext] = array();
    }
}
$cnt_classes = count($classes);
foreach ($classes as $c) {
    if (strpos($c, "_") !== false) {
        $err++;
        $ref = new ReflectionClass($c);
        if (!($ext = $ref->getExtensionName())) {
            $ext = $ref->isInternal() ? "<internal>" : "<user>";
        }
        if (!array_key_exists($ext, $extensions)) {
            $extensions[$ext] = array();
        }
        $extensions[$ext][$c] = array();
        foreach (get_class_methods($c) as $method) {
            $cnt_methods++;
            if (strpos(substr($method, substr($method, 0, 2) != "__" ? 0 : 2), "_") !== false) {
                $err++;
                $extensions[$ext][$c][] = $method;
            }
        }
    } else {
        $cnt_methods += count(get_class_methods($c));
开发者ID:cefalo19,项目名称:php-src,代码行数:31,代码来源:search_underscores.php

示例8: ReflectionClass

<?php

$ref = new ReflectionClass('ReflectionClass');
var_dump($ref->getExtension() instanceof ReflectionExtension);
var_dump(is_string($ref->getExtensionName()));
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:ReflectionClass_extension.php


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