public static function groupByType(array $objects)
    {
        $perType = [];
        foreach ($objects as $object) {
            $type = $object->getType();
            if (!isset($perType[$type])) {
                $perType[$type] = [];
            }
            $perType[$type][] = $object;
        }
        return $perType;
    }
public static function groupByType(array $objects)
    {
        $perType = [];
        foreach ($objects as $object) {
            $type = $object->getType();
            if (!isset($perType[$type])) {
                $perType[$type] = [];
            }
            $perType[$type][] = $object;
        }
        return $perType;
    }
public static function groupByType ( array $ objects ) { $ perType = [ ] ; foreach ( $ objects as $ object ) { $ type = $ object -> getType ( ) ; if ( ! isset ( $ perType [ $ type ] ) ) { $ perType [ $ type ] = [ ] ; } $ perType [ $ type ] [ ] = $ object ; } return $ perType ; }
Group typed objects by their type

@param Typed[] $objects
@return Typed[][] map indexed by types and lists of objects as values
Group typed objects by their type