public static function fromObjects($array, $key) {
        $elements = array();
        foreach ($array as $element) {
            $result = call_user_func(array($element, $key));
            $elements = array_merge($elements, is_array($result) ? $result : array($result));
        }
        return new self($elements);
    }
public static function fromObjects($array, $key) {
        $elements = array();
        foreach ($array as $element) {
            $result = call_user_func(array($element, $key));
            $elements = array_merge($elements, is_array($result) ? $result : array($result));
        }
        return new self($elements);
    }
public static function fromObjects ( $ array , $ key ) { $ elements = array ( ) ; foreach ( $ array as $ element ) { $ result = call_user_func ( array ( $ element , $ key ) ) ; $ elements = array_merge ( $ elements , is_array ( $ result ) ? $ result : array ( $ result ) ) ; } return new self ( $ elements ) ; }
Creates a partition from a set of objects.
@param array $array
@param callable $key
@return Partition
Creates a partition from a set of objects .