本文整理汇总了PHP中ReflectionMethod::getShortName方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionMethod::getShortName方法的具体用法?PHP ReflectionMethod::getShortName怎么用?PHP ReflectionMethod::getShortName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionMethod
的用法示例。
在下文中一共展示了ReflectionMethod::getShortName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $className
* @param string $methodName
* @param Factory $factory <-
*/
public function __construct($className, $methodName, Factory $factory)
{
parent::__construct(self::asClass($className, $methodName), $factory);
$this->method = new \ReflectionMethod($className, $methodName);
$this->createClassDefinition();
$this->setName(ucfirst(preg_replace('/([a-z])([A-Z])/', '$1 $2', $this->method->getShortName())));
}
示例2: getCallableName
/**
* @param $callable
*
* @return string
*/
public function getCallableName($callable)
{
$name = '(Unknown)';
if (is_array($callable)) {
$method = new \ReflectionMethod($callable[0], $callable[1]);
$className = $method->getDeclaringClass()->getName();
$className = str_replace('Ciconia\\Extension\\', '', $className);
$name = $className . ':' . $method->getShortName();
}
return $name;
}
示例3: assertEqualMethods
/**
* @param \ReflectionMethod $reflectionMethod
* @param \Donquixote\HastyReflectionCommon\Reflection\FunctionLike\MethodReflectionInterface $methodReflection
*/
private function assertEqualMethods(\ReflectionMethod $reflectionMethod, MethodReflectionInterface $methodReflection)
{
$this->assertEquals($reflectionMethod->isAbstract(), $methodReflection->isAbstract());
$this->assertEquals($reflectionMethod->getDeclaringClass()->getName(), $methodReflection->getDeclaringClassName());
$this->assertEquals($reflectionMethod->getDocComment(), $methodReflection->getDocComment());
$this->assertEquals($reflectionMethod->getShortName(), $methodReflection->getName());
$this->assertEquals($reflectionMethod->getName(), $methodReflection->getName());
$this->assertEquals($reflectionMethod->class . '::' . $reflectionMethod->getName(), $methodReflection->getQualifiedName());
$this->assertEquals($reflectionMethod->returnsReference(), $methodReflection->isByReference());
$this->assertEquals($reflectionMethod->isPrivate(), $methodReflection->isPrivate());
$this->assertEquals($reflectionMethod->isProtected(), $methodReflection->isProtected());
$this->assertEquals($reflectionMethod->isPublic(), $methodReflection->isPublic());
$this->assertEquals($reflectionMethod->isStatic(), $methodReflection->isStatic());
}
示例4: addMethod
/**
* Add a method to the reflected class.
*
* @param ReflectionMethod $method
*/
public function addMethod(ReflectionMethod $method)
{
$this->methods[$method->getShortName()] = $method;
$method->setDeclaringClassLike($this);
$method->setFilename($this->getFileName());
return $this;
}
示例5: fieldFromInjector
/**
* @param \ReflectionMethod $method
* @return string
* @todo ¿Quizás moverlo al Inflector?
*/
private static function fieldFromInjector(\ReflectionMethod $method)
{
$name = substr($method->getShortName(), strlen('inject'));
return Inflector::hyphenate($name);
}
示例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";
示例7: processMetadataForMethod
/**
* handle custom metadata for method annotation
*
* @param ClassMetadata $metadata
* @param \ReflectionMethod $method
*/
public function processMetadataForMethod(ClassMetadata $metadata, \ReflectionMethod $method)
{
$metadata->tags[$this->key] = $this->value;
$metadata->tags[$this->key . '.target'] = $method->getShortName();
}
示例8: isMethod
private static function isMethod(\ReflectionMethod $method, $prefix)
{
return $method->isPublic() && !$method->isStatic() && 0 === $method->getNumberOfRequiredParameters() && $prefix === substr($method->getShortName(), 0, strlen($prefix));
}