本文整理汇总了PHP中Reflector::getParentClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Reflector::getParentClass方法的具体用法?PHP Reflector::getParentClass怎么用?PHP Reflector::getParentClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reflector
的用法示例。
在下文中一共展示了Reflector::getParentClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCodeDocs
/**
* @param \Reflector $reflection
* @param string $type
* If we are not reflecting the class itself, specify "Method", "Property", etc.
*
* @return array
*/
public static function getCodeDocs($reflection, $type = NULL)
{
$docs = self::parseDocBlock($reflection->getDocComment());
// Recurse into parent functions
if (isset($docs['inheritDoc'])) {
unset($docs['inheritDoc']);
$newReflection = NULL;
try {
if ($type) {
$name = $reflection->getName();
$reflectionClass = $reflection->getDeclaringClass()->getParentClass();
if ($reflectionClass) {
$getItem = "get{$type}";
$newReflection = $reflectionClass->{$getItem}($name);
}
} else {
$newReflection = $reflection->getParentClass();
}
} catch (\ReflectionException $e) {
}
if ($newReflection) {
// Mix in
$additionalDocs = self::getCodeDocs($newReflection, $type);
if (!empty($docs['comment']) && !empty($additionalDocs['comment'])) {
$docs['comment'] .= "\n\n" . $additionalDocs['comment'];
}
$docs += $additionalDocs;
}
}
return $docs;
}
示例2: heritedMethods
/**
*
* @return array
*/
public function heritedMethods()
{
if (!$this->reflector instanceof Reflection\ReflectionClass) {
return array();
}
$parent = $this->reflector->getParentClass();
if (empty($parent)) {
return array();
}
$methods = array();
$this->getParentMethods($parent, $methods);
return $methods;
}
示例3: annotateParent
function annotateParent(\Reflector $refl)
{
$parent = $refl->getParentClass();
if ($parent) {
return array('parent' => $parent->name);
} else {
return array();
}
}