code: public static function memoize(callable $provider)
      {
          return function () use ($provider) {
              static $result;
              static $isConstant;
  
              if ($isConstant) {
                  return $result;
              }
  
              $isConstant = true;
  
              return $result = $provider();
          };
      }
docs: 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.