Interop\Async\Loop::getState PHP Метод

getState() публичный статический Метод

Stored information is package private. Packages MUST NOT retrieve the stored state of other packages. Packages MUST use the following prefix for keys: vendor.package.
public static getState ( string $key ) : mixed
$key string The namespaced storage key.
Результат mixed The previously stored value or `null` if it doesn't exist.
    public static function getState($key)
    {
        $driver = self::$driver ?: self::get();
        return $driver->getState($key);
    }

Usage Example

Пример #1
0
 /**
  * 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;
 }