public static function WebformReflectionHelper::getParentClasses in Webform 8.5
Same name and namespace in other branches
- 6.x src/Utility/WebformReflectionHelper.php \Drupal\webform\Utility\WebformReflectionHelper::getParentClasses()
Get an object's class hierarchy.
Parameters
object $object: An object.
string $base_class_name: (optional) Base class name to use as the root of object's class hierarchy.
Return value
array An array containing this elements class hierarchy.
3 calls to WebformReflectionHelper::getParentClasses()
- WebformElementBase::getRelatedTypes in src/
Plugin/ WebformElementBase.php - Get related element types.
- WebformPluginElementController::index in src/
Controller/ WebformPluginElementController.php - WebformReflectionHelperTest::testGetParentClasses in tests/
src/ Unit/ Utility/ WebformReflectionHelperTest.php - Tests WebformReflectionHelper get parent classes with WebformReflectionHelper::getParentClasses().
File
- src/
Utility/ WebformReflectionHelper.php, line 49
Class
- WebformReflectionHelper
- Helper class for reflection methods.
Namespace
Drupal\webform\UtilityCode
public static function getParentClasses($object, $base_class_name = '') {
$class = get_class($object);
$parent_classes = [];
while ($class_name = self::getClassName($class)) {
$parent_classes[] = $class_name;
$class = get_parent_class($class);
if ($class_name === $base_class_name || !$class) {
break;
}
}
return array_reverse($parent_classes);
}