Added method \ncc\Runtime > Constants > get()
https://git.n64.cc/nosial/ncc/-/issues/33
This commit is contained in:
parent
553bf5ede0
commit
0fbb374507
1 changed files with 20 additions and 0 deletions
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue