本文整理汇总了PHP中Reflector::getShortName方法的典型用法代码示例。如果您正苦于以下问题:PHP Reflector::getShortName方法的具体用法?PHP Reflector::getShortName怎么用?PHP Reflector::getShortName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reflector
的用法示例。
在下文中一共展示了Reflector::getShortName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromReflector
/**
* Generate class / function info
*
* @param Reflector $reflector Class name or reflection object
* @param string $single Skip parent classes
* @param Reflector|null $context Object context (for methods)
* @return string
*/
protected function fromReflector(\Reflector $reflector, $single = '', \Reflector $context = null)
{
// @todo: test this
$hash = var_export(func_get_args(), true);
//$hash = $reflector->getName() . ';' . $single . ';' . ($context ? $context->getName() : '');
if ($this->fmt->didCache($hash)) {
static::$debug['cacheHits']++;
return;
}
$items = array($reflector);
if ($single === '' && $reflector instanceof \ReflectionClass) {
$items = static::getParentClasses($reflector);
}
$first = true;
foreach ($items as $item) {
if (!$first) {
$this->fmt->sep(' :: ');
}
$first = false;
$name = $single !== '' ? $single : $item->getName();
$comments = $item->isInternal() ? array() : static::parseComment($item->getDocComment());
$meta = array('sub' => array());
$bubbles = array();
if ($item->isInternal()) {
$extension = $item->getExtension();
$meta['title'] = $extension instanceof \ReflectionExtension ? sprintf('Internal - part of %s (%s)', $extension->getName(), $extension->getVersion()) : 'Internal';
} else {
$comments = static::parseComment($item->getDocComment());
if ($comments) {
$meta += $comments;
}
$meta['sub'][] = array('Defined in', basename($item->getFileName()) . ':' . $item->getStartLine());
}
if ($item instanceof \ReflectionFunction || $item instanceof \ReflectionMethod) {
if ($context !== null && $context->getShortName() !== $item->getDeclaringClass()->getShortName()) {
$meta['sub'][] = array('Inherited from', $item->getDeclaringClass()->getShortName());
}
if ($item instanceof \ReflectionMethod) {
try {
$proto = $item->getPrototype();
$meta['sub'][] = array('Prototype defined by', $proto->class);
} catch (\Exception $e) {
}
}
$this->fmt->text('name', $name, $meta, $this->linkify($item));
continue;
}
// @todo: maybe - list interface methods
if (!($item->isInterface() || static::$env['is54'] && $item->isTrait())) {
if ($item->isAbstract()) {
$bubbles[] = array('A', 'Abstract');
}
if ($item->isFinal()) {
$bubbles[] = array('F', 'Final');
}
// php 5.4+ only
if (static::$env['is54'] && $item->isCloneable()) {
$bubbles[] = array('C', 'Cloneable');
}
if ($item->isIterateable()) {
$bubbles[] = array('X', 'Iterateable');
}
}
if ($item->isInterface() && $single !== '') {
$bubbles[] = array('I', 'Interface');
}
if ($bubbles) {
$this->fmt->bubbles($bubbles);
}
if ($item->isInterface() && $single === '') {
$name .= sprintf(' (%d)', count($item->getMethods()));
}
$this->fmt->text('name', $name, $meta, $this->linkify($item));
}
$this->fmt->cacheLock($hash);
}
示例2: isValidTestFile
private function isValidTestFile(\Reflector $reflector, array $testFiles)
{
return in_array($reflector->getFileName(), $testFiles) && isValidTestName($reflector->getShortName());
}