public static function memoize(callable $provider)
    {
        return function () use ($provider) {
            static $result;
            static $isConstant;

            if ($isConstant) {
                return $result;
            }

            $isConstant = true;

            return $result = $provider();
        };
    }
public static function memoize(callable $provider)
    {
        return function () use ($provider) {
            static $result;
            static $isConstant;

            if ($isConstant) {
                return $result;
            }

            $isConstant = true;

            return $result = $provider();
        };
    }
public static function memoize ( callable $ provider ) { return function ( ) use ( $ provider ) { static $ result ; static $ isConstant ; if ( $ isConstant ) { return $ result ; } $ isConstant = true ; return $ result = $ provider ( ) ; } ; }
Wraps a credentials provider and caches previously provided credentials.

@param callable $provider Credentials provider to wrap.

@return callable Wrapped provider that returns cached credentials when called.
Wraps a credentials provider and caches previously provided credentials .