25 lines
514 B
PHP
Executable File
25 lines
514 B
PHP
Executable File
<?php
|
|
namespace Rails\Toolbox;
|
|
|
|
class ClassTools
|
|
{
|
|
/**
|
|
* Returns all parents of a class.
|
|
*
|
|
* @return array
|
|
*/
|
|
static public function getParents($className)
|
|
{
|
|
$parents = [];
|
|
$parent = new \ReflectionClass($className);
|
|
while (true) {
|
|
$parent = $parent->getParentClass();
|
|
if (!$parent) {
|
|
break;
|
|
} else {
|
|
$parents[] = $parent->getName();
|
|
}
|
|
}
|
|
return $parents;
|
|
}
|
|
} |