From a13636a2f2837709cf8409af1c37fbe0a4d5a750 Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.uk>
Date: Thu, 19 Mar 2020 23:23:41 +0000
Subject: [PATCH] Use a method for sorting articles

Fixes #13
---
 README.md | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 11efd72..1a7bf08 100644
--- a/README.md
+++ b/README.md
@@ -904,12 +904,15 @@ To order the articles by their created date, we can update the `getAll()` method
       'type' => 'article',
     ]);
 +
-+   // Sort the articles by their created date.
++   $this->sortByCreatedDate($articles);
++
++   return $articles;
++ }
++
++ private function sortByCreatedDate(array &$articles): void {
 +   uasort($articles, function (NodeInterface $a, NodeInterface $b): bool {
 +     return $a->getCreatedTime() < $b->getCreatedTime();
 +   });
-+
-+   return $articles;
   }
 ```