From 7bc9f0029aa90aa8adc9f84a530e2904b6a7b70b Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Mon, 29 Sep 2014 12:15:44 +1000 Subject: [PATCH] Simplify code using class_uses_recursive helper --- modules/backend/traits/InspectableContainer.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/modules/backend/traits/InspectableContainer.php b/modules/backend/traits/InspectableContainer.php index 0e53f5c6c..3b6eb64ca 100644 --- a/modules/backend/traits/InspectableContainer.php +++ b/modules/backend/traits/InspectableContainer.php @@ -24,19 +24,7 @@ trait InspectableContainer if (!$className) throw new ApplicationException('The inspectable class name is not specified.'); - $classes = class_parents($className); - array_unshift($classes, $className); - - $traitFound = false; - foreach ($classes as $class) { - $traits = class_uses($class); - - if (in_array('System\Traits\PropertyContainer', $traits)) { - $traitFound = true; - break; - } - } - + $traitFound = in_array('System\Traits\PropertyContainer', class_uses_recursive($className)); if (!$traitFound) throw new ApplicationException('The options cannot be loaded for the specified class.');