Enchantment: Create constant name once, and reuse it

this is more readable and more maintainable.
This commit is contained in:
Dylan K. Taylor 2017-12-21 13:11:31 +00:00
parent c2b0f6af22
commit a842a5319f

View File

@ -116,8 +116,9 @@ class Enchantment{
* @return Enchantment|null
*/
public static function getEnchantmentByName(string $name){
if(defined(Enchantment::class . "::" . strtoupper($name))){
return self::getEnchantment(constant(Enchantment::class . "::" . strtoupper($name)));
$const = Enchantment::class . "::" . strtoupper($name);
if(defined($const)){
return self::getEnchantment(constant($const));
}
return null;
}