src/ClientSideMonitoring/ConfigurationProvider.php
public static function memoize(callable $provider)
    {
        return function () use ($provider) {
            static $result;
            static $isConstant;

            // Constant config will be returned constantly.
            if ($isConstant) {
                return $result;
            }

            // Create the initial promise that will be used as the cached value
            // until it expires.
            if (null === $result) {
                $result = $provider();
            }

            // Return config and set flag that provider is already set
            return $result
                ->then(function (ConfigurationInterface $config) use (&$isConstant) {
                    $isConstant = true;
                    return $config;
                });
        };
    }
public static function memoize(callable $provider)
    {
        return function () use ($provider) {
            static $result;
            static $isConstant;

            // Constant config will be returned constantly.
            if ($isConstant) {
                return $result;
            }

            // Create the initial promise that will be used as the cached value
            // until it expires.
            if (null === $result) {
                $result = $provider();
            }

            // Return config and set flag that provider is already set
            return $result
                ->then(function (ConfigurationInterface $config) use (&$isConstant) {
                    $isConstant = true;
                    return $config;
                });
        };
    }
public static function memoize ( callable $ provider ) { return function ( ) use ( $ provider ) { static $ result ; static $ isConstant ; // Constant config will be returned constantly. if ( $ isConstant ) { return $ result ; } // Create the initial promise that will be used as the cached value // until it expires. if ( null === $ result ) { $ result = $ provider ( ) ; } // Return config and set flag that provider is already set return $ result -> then ( function ( ConfigurationInterface $ config ) use ( & $ isConstant ) { $ isConstant = true ; return $ config ; } ) ; } ; }
Wraps a CSM config provider and caches previously provided configuration.

Ensures that cached configuration is refreshed when it expires.

@param callable $provider CSM config provider function to wrap.

@return callable
Wraps a CSM config provider and caches previously provided configuration .