Added method \ncc\Runtime > Constants > get()

https://git.n64.cc/nosial/ncc/-/issues/33
This commit is contained in:
Netkas 2022-12-15 00:54:38 -05:00
parent 553bf5ede0
commit 0fbb374507

View file

@ -68,4 +68,24 @@
unset(self::$Constants[$constant_hash]); unset(self::$Constants[$constant_hash]);
} }
/**
* Gets the constant
*
* @param string $scope
* @param string $name
* @return string|null
*/
public static function get(string $scope, string $name): ?string
{
if(!Validate::constantName($name))
return null;
$constant_hash = Resolver::resolveConstantHash($scope, $name);
if(isset(self::$Constants[$constant_hash]))
return self::$Constants[$constant_hash]->getValue();
return null;
}
} }