/**
* Registers a Global.
*
* New globals can be added before compiling or rendering a template;
* but after, you can only update existing globals.
*
* @param mixed $value The global value
*/
public function addGlobal(string
$name,
$value) { if ($this->extensionSet->
isInitialized() && !\
array_key_exists($name,
$this->
getGlobals())) { throw new \
LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.',
$name));
} if (null !==
$this->resolvedGlobals
) { $this->resolvedGlobals
[$name] =
$value;
} else { $this->globals
[$name] =
$value;
} } /**
* @internal
*
* @return array<string, mixed>
*/