/** * Load the current loop config from the loop registry. * * Will return a shared default config if used outside of a KoolKode loop implementations run method. * * Do not keep a reference to the component as it can change depending on the active loop! */ public static function currentConfig() : LoopConfig { $config = LoopRegistry::getState(LoopConfig::class); if ($config instanceof LoopConfig) { return $config; } if (self::$defaultConfig === null) { return self::$defaultConfig = new LoopConfig(); } return self::$defaultConfig; }