本文整理匯總了PHP中lang\XPClass::getModifiers方法的典型用法代碼示例。如果您正苦於以下問題:PHP XPClass::getModifiers方法的具體用法?PHP XPClass::getModifiers怎麽用?PHP XPClass::getModifiers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lang\XPClass
的用法示例。
在下文中一共展示了XPClass::getModifiers方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: printClass
/**
* Handles classes
*
* @param lang.XPClass class
*/
protected static function printClass(XPClass $class)
{
Console::write(implode(' ', Modifiers::namesOf($class->getModifiers())));
Console::write(' class ', self::displayNameOf($class));
if ($parent = $class->getParentClass()) {
Console::write(' extends ', self::displayNameOf($parent));
}
if ($interfaces = $class->getDeclaredInterfaces()) {
Console::write(' implements ');
$s = sizeof($interfaces) - 1;
foreach ($interfaces as $i => $iface) {
Console::write(self::displayNameOf($iface));
$i < $s && Console::write(', ');
}
}
// Constants
Console::writeLine(' {');
$i = 0;
foreach ($class->getConstants() as $name => $value) {
Console::writeLine(' const ', $name, ' = ', \xp::stringOf($value));
$i++;
}
// Fields
$i && Console::writeLine();
$i = 0;
foreach ($class->getFields() as $field) {
Console::writeLine(' ', $field);
$i++;
}
// Constructor
$i && Console::writeLine();
$i = 0;
if ($class->hasConstructor()) {
Console::writeLine(' ', $class->getConstructor());
$i++;
}
// Methods
$i && Console::writeLine();
self::printMethods($class->getMethods());
Console::writeLine('}');
}