From 278c7a1d44887711d9d695d615e973ede7463cb8 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 27 Sep 2019 01:54:13 +0100 Subject: [PATCH] Use 'new Collection' rather than global collect function --- src/Talks/src/TwigExtension/TalksExtension.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Talks/src/TwigExtension/TalksExtension.php b/src/Talks/src/TwigExtension/TalksExtension.php index 3a199585..d009ab76 100644 --- a/src/Talks/src/TwigExtension/TalksExtension.php +++ b/src/Talks/src/TwigExtension/TalksExtension.php @@ -60,7 +60,7 @@ class TalksExtension extends AbstractExtension */ public function getTalks($talks): Collection { - return collect($talks)->sortBy(function ($talk) { + return (new Collection($talks))->sortBy(function ($talk) { return $this->getLastDate($talk); }); } @@ -81,7 +81,7 @@ class TalksExtension extends AbstractExtension private function getLastDate($talk): string { - return $this->eventsFromTalks(collect([$talk])) + return $this->eventsFromTalks(new Collection([$talk])) ->pluck('date')->max(); } @@ -101,7 +101,7 @@ class TalksExtension extends AbstractExtension private function eventsFromTalks($talks): Collection { - return collect($talks)->flatMap(function ($talk): array { + return (new Collection($talks))->flatMap(function ($talk): array { return $talk['events']; }); }