summaryrefslogtreecommitdiff
path: root/app/Family.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-01-10 13:11:00 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-01-10 13:11:00 +0000
commitc156e8f563be94a0ce9cac0af05ca20d19b86053 (patch)
treeaa2711214d61107582ef93bd7db727f77f173d99 /app/Family.php
parente20d75ff1ebf84eb9e205e57fa86c7fa41df1457 (diff)
downloadwebtrees-c156e8f563be94a0ce9cac0af05ca20d19b86053.tar.gz
webtrees-c156e8f563be94a0ce9cac0af05ca20d19b86053.tar.bz2
webtrees-c156e8f563be94a0ce9cac0af05ca20d19b86053.zip
Use closures as callbacks for sorting
Diffstat (limited to 'app/Family.php')
-rw-r--r--app/Family.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/app/Family.php b/app/Family.php
index 0f740f35de..c559a2deb7 100644
--- a/app/Family.php
+++ b/app/Family.php
@@ -77,6 +77,19 @@ class Family extends GedcomRecord
}
/**
+ * A closure which will compare families by marriage date.
+ *
+ * @return Closure
+ */
+ public static function marriageDateComparator(): Closure
+ {
+ return function (Family $x, Family $y): int
+ {
+ return Date::compare($x->getMarriageDate(), $y->getMarriageDate());
+ };
+ }
+
+ /**
* Get an instance of a family object. For single records,
* we just receive the XREF. For bulk records (such as lists
* and search results) we can receive the GEDCOM data as well.
@@ -270,19 +283,6 @@ class Family extends GedcomRecord
}
/**
- * Static helper function to sort an array of families by marriage date
- *
- * @param Family $x
- * @param Family $y
- *
- * @return int
- */
- public static function compareMarrDate(Family $x, Family $y): int
- {
- return Date::compare($x->getMarriageDate(), $y->getMarriageDate());
- }
-
- /**
* Number of children - for the individual list
*
* @return int