/** * Static helper function to sort an array of objects by name * Records whose names cannot be displayed are sorted at the end. * * @param GedcomRecord $x * @param GedcomRecord $y * * @return int */ public static function compare(GedcomRecord $x, GedcomRecord $y) { if ($x->canShowName()) { if ($y->canShowName()) { return I18N::strcasecmp($x->getSortName(), $y->getSortName()); } else { return -1; // only $y is private } } else { if ($y->canShowName()) { return 1; // only $x is private } else { return 0; // both $x and $y private } } }