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


PHP ReflectionFunction::getExtension方法代码示例

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


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

示例1: testGetExtension

 public function testGetExtension()
 {
     self::assertEquals($this->php_fctM1->getExtension(), $this->fctM1->getExtension());
     self::assertEquals($this->php_fctM2->getExtension(), $this->fctM2->getExtension());
     self::assertEquals($this->php_fctM3->getExtension(), $this->fctM3->getExtension());
     self::assertEquals((string) $this->php_fct_method_exists->getExtension(), (string) $this->fct_method_exists->getExtension());
 }
开发者ID:naderman,项目名称:ezc-reflection,代码行数:7,代码来源:function_test.php

示例2: getExtension

 /**
  * Returns NULL or the extension the function belongs to
  *
  * @return ezcReflectionExtension Extension the function belongs to
  */
 public function getExtension()
 {
     if ($this->getExtensionName() === false) {
         return null;
     } else {
         if ($this->reflectionSource instanceof ReflectionFunction) {
             return new ezcReflectionExtension($this->reflectionSource->getExtension());
         } else {
             // using the name, since otherwhise the object would be treated like an
             // external reflection implementation and that would decrease performance
             return new ezcReflectionExtension(parent::getExtensionName());
         }
     }
 }
开发者ID:zetacomponents,项目名称:reflection,代码行数:19,代码来源:function.php

示例3: getExtension

 /**
  * @return ExtensionReflection
  */
 public function getExtension()
 {
     return ($ref = parent::getExtension()) ? ExtensionReflection::import($ref) : NULL;
 }
开发者ID:regiss,项目名称:texyla-s-Nete1-PhP-5.2,代码行数:7,代码来源:FunctionReflection.php

示例4: populate_method_info

/**
 * returns an array containing a record for each defined method.
 */
function populate_method_info()
{
    $method_info = array();
    // get functions
    $all_functions = get_defined_functions();
    $internal_functions = $all_functions["internal"];
    foreach ($internal_functions as $function) {
        // populate new method record
        $function_record = array();
        $function_record[CLASS_NAME] = "Function";
        $function_record[METHOD_NAME] = $function;
        $function_record[IS_TESTED] = "no";
        $function_record[TESTS] = "";
        $function_record[IS_DUPLICATE] = false;
        // record the extension that the function belongs to
        $reflectionFunction = new ReflectionFunction($function);
        $extension = $reflectionFunction->getExtension();
        if ($extension != null) {
            $function_record[EXTENSION_NAME] = $extension->getName();
        } else {
            $function_record[EXTENSION_NAME] = "";
        }
        // insert new method record into info array
        $method_info[] = $function_record;
    }
    // get methods
    $all_classes = get_declared_classes();
    foreach ($all_classes as $class) {
        $reflectionClass = new ReflectionClass($class);
        $methods = $reflectionClass->getMethods();
        foreach ($methods as $method) {
            // populate new method record
            $new_method_record = array();
            $new_method_record[CLASS_NAME] = $reflectionClass->getName();
            $new_method_record[METHOD_NAME] = $method->getName();
            $new_method_record[IS_TESTED] = "no";
            $new_method_record[TESTS] = "";
            $extension = $reflectionClass->getExtension();
            if ($extension != null) {
                $new_method_record[EXTENSION_NAME] = $extension->getName();
            } else {
                $new_method_record[EXTENSION_NAME] = "";
            }
            // check for duplicate method names
            $new_method_record[IS_DUPLICATE] = false;
            foreach ($method_info as &$current_record) {
                if (strcmp($current_record[METHOD_NAME], $new_method_record[METHOD_NAME]) == 0) {
                    $new_method_record[IS_DUPLICATE] = true;
                    $current_record[IS_DUPLICATE] = true;
                }
            }
            // insert new method record into info array
            $method_info[] = $new_method_record;
        }
    }
    return $method_info;
}
开发者ID:cefalo19,项目名称:php-src,代码行数:60,代码来源:find_tested.php

示例5: foo

<?php

function foo()
{
}
$function = new ReflectionFunction('sort');
var_dump($function->getExtension());
$function = new ReflectionFunction('foo');
var_dump($function->getExtension());
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:ReflectionFunction_getExtension.php


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