From 10348fe4295f6de89f153c3a86e4b9eb3f440442 Mon Sep 17 00:00:00 2001 From: Ricardo Vargas Date: Tue, 7 Feb 2023 07:58:18 -0400 Subject: [PATCH] Adding helper method on the Types enum. --- src/helpers/Types.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/helpers/Types.php b/src/helpers/Types.php index 78649b9..60d58c7 100644 --- a/src/helpers/Types.php +++ b/src/helpers/Types.php @@ -18,4 +18,13 @@ public function toString(): string self::PASSPORT => 'Pasaporte', }; } + + public function fromString(string $string): self + { + return match ($string) { + 'RNC' => self::RNC, + 'Cédula' => self::CEDULA, + 'Pasaporte' => self::PASSPORT, + }; + } }