From 1a37c7bad4f443cea88c405bcab56c4470913f35 Mon Sep 17 00:00:00 2001 From: Peter Burian Date: Mon, 20 May 2024 07:24:42 +0000 Subject: [PATCH] Improved parsed banking transaction mails/parsed mail logs. - Added ability to change parsed mail's state. - Added ability to change parsed mail's note. - Added ability to track source bank account (updated `CsobMailParser` & `TatraBankaMailParser` + logging through `MailProcessor`) - Refactored `ParsedMailLog`'s State constants/enum - Added `EnumHelper` to simplify work with enum especially with Nette forms (enum values listing) remp/respekt#189 --- src/Helpers/EnumHelper.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/Helpers/EnumHelper.php diff --git a/src/Helpers/EnumHelper.php b/src/Helpers/EnumHelper.php new file mode 100644 index 0000000..cf2f5de --- /dev/null +++ b/src/Helpers/EnumHelper.php @@ -0,0 +1,37 @@ +'friendly name'. Initially intended for use in a Nette forms. + * Without overriding the method returns the 'friendly name' the same as the 'enum value' or + * in case of non-backed enum it returns a pair of 'enum keys'. + */ + public static function getFriendlyList(): array + { + $values = self::values(); + + $isNonBackedEnum = count($values) === 0; + if ($isNonBackedEnum) { + $names = self::names(); + return array_combine($names, $names); + } + + return array_combine($values, $values); + } +}