|
|
|
|
@ -44,7 +44,7 @@ trait TRegistry {
|
|
|
|
|
* @throws Throwable If an error occur
|
|
|
|
|
*/
|
|
|
|
|
protected static function addEntry (string $name, ...$args): void {
|
|
|
|
|
if (static::hasEntry($name)) {
|
|
|
|
|
if (self::_hasEntry($name)) {
|
|
|
|
|
throw new InvalidArgumentException('An entry with "' . $name . '" already exists');
|
|
|
|
|
}
|
|
|
|
|
static::$registerEntries[$name] = $args;
|
|
|
|
|
@ -68,6 +68,20 @@ trait TRegistry {
|
|
|
|
|
if (count(static::$registerEntries[$name] ?? []) === 0) {
|
|
|
|
|
static::initializeEntries();
|
|
|
|
|
}
|
|
|
|
|
return self::_hasEntry($name);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Internally check if an entry name already exists.
|
|
|
|
|
*
|
|
|
|
|
* DO NOT trigger {@see TRegistry::initializeEntries()} if not entry
|
|
|
|
|
*
|
|
|
|
|
* @param string $name The entry name
|
|
|
|
|
*
|
|
|
|
|
* @return bool TRUE if the entry name already exists
|
|
|
|
|
*
|
|
|
|
|
* @throws Throwable If an error occur
|
|
|
|
|
*/
|
|
|
|
|
protected static final function _hasEntry (string $name): bool {
|
|
|
|
|
return isset(static::$registerEntries[$name]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|