Add getName method to NameValue class

This commit is contained in:
Kendrick Chan 2018-02-01 23:11:34 +08:00
parent 92715265b3
commit ec68b7a787

View file

@ -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';
}
}