From ec68b7a787764d55509ebe0b72d7b66fee8bcf16 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Thu, 1 Feb 2018 23:11:34 +0800 Subject: [PATCH] Add getName method to NameValue class --- src/Ramcar/NameValue.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Ramcar/NameValue.php b/src/Ramcar/NameValue.php index ef513c66..58b6d75e 100644 --- a/src/Ramcar/NameValue.php +++ b/src/Ramcar/NameValue.php @@ -9,11 +9,19 @@ class NameValue return static::COLLECTION; } - static public function validate($type_text) + static public function validate($value) { - if (isset(static::COLLECTION[$type_text])) + if (isset(static::COLLECTION[$value])) return true; return false; } + + static public function getName($value) + { + if (isset(static::COLLECTION[$value])) + return static::COLLECTION[$value]; + + return 'Unknown'; + } }