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


PHP ReflectionFunction::getShortName方法代码示例

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


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

示例1: import

 public function import(\ReflectionFunction $function)
 {
     $this->name = $function->name;
     $this->function = $function->getShortName();
     $this->namespace = $function->getNamespaceName();
     $this->_importFromReflection($function);
 }
开发者ID:bzick,项目名称:koda,代码行数:7,代码来源:FunctionInfo.php

示例2: definition

function definition($functionName)
{
    $details = new \ReflectionFunction("JREAM\\{$functionName}");
    $output = '<div>';
    $output .= "<strong>{$details->getShortName()}</strong>( ";
    foreach ($details->getParameters() as $reflectObj) {
        foreach ($reflectObj as $arg) {
            $output .= "\${$arg}, ";
        }
    }
    $output = rtrim($output, ' ,');
    $output .= " )";
    $output .= '</div>';
    return $output;
}
开发者ID:JREAM,项目名称:array-functions,代码行数:15,代码来源:example_functions.php

示例3: forFunction

 /**
  * @param $function
  * @return BuildParameterArray
  * @throws \ReflectionException
  */
 public static function forFunction($function)
 {
     if (!is_callable($function)) {
         $template = 'Error building parameters, Function {$method_name} does not exist';
         $message = (new ReplaceVarsFromArray($template))->apply(['method_name' => $function]);
         throw new \ReflectionException($message);
     }
     // Allow for [$class, $method] callable syntax which doesn't work with
     // ReflectionFunction.
     if (is_array($function)) {
         list($class, $method) = $function;
         return static::forMethod($class, $method);
     }
     $reflection_function = new \ReflectionFunction($function);
     $reflection_parameters = $reflection_function->getParameters();
     return new static($reflection_parameters, $reflection_function->getShortName());
 }
开发者ID:kamioftea,项目名称:php-util,代码行数:22,代码来源:BuildParameterArray.php

示例4: fromCallable

 /**
  * @param callable $function
  *
  * @return \ReflectionFunctionAbstract
  * @throws InvalidFunctionException
  */
 public static final function fromCallable(callable $function)
 {
     // If is array it could be an instance or static method:
     // ['class', 'method'] or [$instance, 'method'];
     if (is_array($function)) {
         return new \ReflectionMethod($function[0], $function[1]);
     } elseif ($function instanceof \Closure) {
         $reflection = new \ReflectionFunction($function);
         // If the name is {closure} it as an actual closure
         if ($reflection->getShortName() === '{closure}') {
             return $reflection;
         }
         // Bail out, no (sane) way of determining the actual function
         // represented by the closure
         throw InvalidFunctionException::invalidFunctionMessage('The function has been wrapped in closure ' . '(most likely  via ReflectionFunction::getClosure or \\ReflectionMethod::getClosure) ' . 'and this is not supported', $reflection);
     } elseif (is_object($function)) {
         return new \ReflectionMethod($function, '__invoke');
     } else {
         $name = null;
         is_callable($function, false, $name);
         return new \ReflectionFunction($name);
     }
 }
开发者ID:timetoogo,项目名称:pinq,代码行数:29,代码来源:Reflection.php

示例5: foo

<?php

namespace A\B;

function foo()
{
}
$function = new \ReflectionFunction('sort');
var_dump($function->inNamespace());
var_dump($function->getName());
var_dump($function->getNamespaceName());
var_dump($function->getShortName());
$function = new \ReflectionFunction('A\\B\\foo');
var_dump($function->inNamespace());
var_dump($function->getName());
var_dump($function->getNamespaceName());
var_dump($function->getShortName());
开发者ID:badlamer,项目名称:hhvm,代码行数:17,代码来源:ReflectionFunction_getNamespaceName.php

示例6: test

    $staticX++;
    $x = $staticX;
    return $x;
}
class Test
{
    public function test()
    {
    }
}
$rf = new \ReflectionFunction('\\foo\\bar\\f');
print "--- getShortName(\"\\foo\\bar\\f\") ---\n";
var_dump($rf->getShortName());
print "\n";
print "--- getNamespaceName(\"\\foo\\bar\\f\") ---\n";
var_dump($rf->getNamespaceName());
print "\n";
$rf = new \ReflectionMethod('\\foo\\bar\\Test', 'test');
print "--- getShortName(\"\\foo\\bar\\Test::test\") ---\n";
var_dump($rf->getShortName());
print "\n";
print "--- getNamespaceName(\"\\foo\\bar\\Test::test\") ---\n";
var_dump($rf->getNamespaceName());
print "\n";
$rf = new \ReflectionFunction('\\strlen');
print "--- getShortName(\"strlen\") ---\n";
var_dump($rf->getShortName());
print "\n";
print "--- getNamespaceName(\"strlen\") ---\n";
var_dump($rf->getNamespaceName());
print "\n";
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:ReflectionFunction_getShortName.php


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