reflection.php
protected function onlyParents($interfaces)
    {
        $parents   = array();
        $blacklist = array();
        foreach ($interfaces as $interface) {
            foreach ($interfaces as $possible_parent) {
                if ($interface->getName() == $possible_parent->getName()) {
                    continue;
                }
                if ($interface->isSubClassOf($possible_parent)) {
                    $blacklist[$possible_parent->getName()] = true;
                }
            }
            if (!isset($blacklist[$interface->getName()])) {
                $parents[] = $interface->getName();
            }
        }

        return $parents;
    }
protected function onlyParents($interfaces)
    {
        $parents   = array();
        $blacklist = array();
        foreach ($interfaces as $interface) {
            foreach ($interfaces as $possible_parent) {
                if ($interface->getName() == $possible_parent->getName()) {
                    continue;
                }
                if ($interface->isSubClassOf($possible_parent)) {
                    $blacklist[$possible_parent->getName()] = true;
                }
            }
            if (!isset($blacklist[$interface->getName()])) {
                $parents[] = $interface->getName();
            }
        }

        return $parents;
    }
Whittles a list of interfaces down to only the necessary top level parents.

@param array $interfaces     Reflection API interfaces to reduce.

@return array               List of parent interface names.