From 89f9d0af3f90511ab04caa6da43f104175998220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Proch=C3=A1zka?= Date: Mon, 5 Sep 2022 15:36:26 +0200 Subject: [PATCH] Implemented missing getItems method in type enum --- src/Enums/Type.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Enums/Type.php b/src/Enums/Type.php index 715e260..8389cd7 100644 --- a/src/Enums/Type.php +++ b/src/Enums/Type.php @@ -16,6 +16,21 @@ enum Type: string implements LabelledEnum case Todo = 'todo'; + /** + * @return string[] + */ + public static function getItems(): iterable + { + $items = []; + + foreach (self::cases() as $case) { + $items[$case->value] = $case->label(); + } + + return $items; + } + + public function label(): string { return match($this) {