mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-30 06:55:11 +00:00
Enchantment: Create constant name once, and reuse it
this is more readable and more maintainable.
This commit is contained in:
parent
c2b0f6af22
commit
a842a5319f
@ -116,8 +116,9 @@ class Enchantment{
|
|||||||
* @return Enchantment|null
|
* @return Enchantment|null
|
||||||
*/
|
*/
|
||||||
public static function getEnchantmentByName(string $name){
|
public static function getEnchantmentByName(string $name){
|
||||||
if(defined(Enchantment::class . "::" . strtoupper($name))){
|
$const = Enchantment::class . "::" . strtoupper($name);
|
||||||
return self::getEnchantment(constant(Enchantment::class . "::" . strtoupper($name)));
|
if(defined($const)){
|
||||||
|
return self::getEnchantment(constant($const));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user