Simplify code using class_uses_recursive helper

This commit is contained in:
Sam Georges 2014-09-29 12:15:44 +10:00
parent c814ad5124
commit 7bc9f0029a
1 changed files with 1 additions and 13 deletions

View File

@ -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.');