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


PHP ReflectionFunction::getExtensionName方法代码示例

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


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

示例1: testGetExtensionName

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

示例2: importSelected

 /**
  * Import a single function
  *
  * @param   string extension
  * @param   string function
  * @return  [:bool] import
  * @throws  lang.IllegalArgumentException if extension or function don't exist
  */
 public function importSelected($extension, $function)
 {
     try {
         $f = new \ReflectionFunction($function);
     } catch (\ReflectionException $e) {
         throw new IllegalArgumentException($e->getMessage());
     }
     if ($extension === strtolower($fe = $f->getExtensionName())) {
         return [$function => true];
     } else {
         throw new IllegalArgumentException('Function ' . $function . ' is not inside extension ' . $extension . ' (but ' . ($fe ?: '(n/a)') . ')');
     }
 }
开发者ID:xp-lang,项目名称:compiler,代码行数:21,代码来源:NativeImporter.class.php

示例3: generateFunction

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

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

示例5: foreach

    $funcs = get_defined_functions();
    foreach ($funcs['internal'] as $func) {
        $rf = new ReflectionFunction($func);
        $info = array('kind' => 'f', 'namespace' => $rf->getNamespaceName());
        $params = array();
        foreach ($rf->getParameters() as $rp) {
            $class = '';
            if (!defined('HHVM_VERSION')) {
                $class = $rp->getClass();
            }
            $param = '';
            if ($class) {
                $param = $class->getName() . ' ';
            } elseif ($rp->isArray()) {
                $param = 'array ';
            }
            $param .= '$' . $rp->getName();
            if ($rp->isOptional() && $rf->isUserDefined()) {
                $param .= '=' . json_encode($rp->getDefaultValue());
            }
            $params[] = $param;
        }
        $info['type'] = '(' . implode(', ', $params) . ')';
        if ($rf->isInternal()) {
            $filename = '(ext-' . $rf->getExtensionName() . ')';
        } else {
            $filename = str_replace($base, '', $rf->getFileName());
        }
        fwrite($fp, implode("\t", array($rf->getName(), $filename, $rf->getStartLine() . ';"', '')) . $build($info) . PHP_EOL);
    }
});
开发者ID:DQNEO,项目名称:prestissimo,代码行数:31,代码来源:bootstrap.php

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

示例7: foo

<?php

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

示例8: ReflectionFunction

<?php

$f = new ReflectionFunction("sleep");
var_dump($f->getExtensionName());
开发者ID:badlamer,项目名称:hhvm,代码行数:4,代码来源:019.php


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