From a1aa2d65bff34b8f5681ed16c992e49384c79f2e Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 16 Mar 2016 23:00:49 +0100 Subject: * CalendarDTO comparator --- app/php/dto/CalendarDTO.php | 4 ++++ app/php/dto/CalendarGroupDTO.php | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'app/php') diff --git a/app/php/dto/CalendarDTO.php b/app/php/dto/CalendarDTO.php index 302fcf4..a222cd6 100644 --- a/app/php/dto/CalendarDTO.php +++ b/app/php/dto/CalendarDTO.php @@ -14,6 +14,10 @@ class CalendarDTO { $this->Website = $calendarRecord->Website; } + public static function __compare(CalendarDTO $cal1, CalendarDTO $cal2) { + return strcmp($cal1->Name, $cal2->Name); + } + } ?> diff --git a/app/php/dto/CalendarGroupDTO.php b/app/php/dto/CalendarGroupDTO.php index 75ec6c6..779422d 100644 --- a/app/php/dto/CalendarGroupDTO.php +++ b/app/php/dto/CalendarGroupDTO.php @@ -23,12 +23,7 @@ class CalendarGroupDTO { } ) ); - usort( - $this->Calendars, - function ($cal1, $cal2) { - return strcmp($cal1->Name, $cal2->Name); - } - ); + usort($this->Calendars, ['CalendarDTO', '__compare']); } } -- cgit v1.2.3