src/SilexPhpRedis/RedisClientProvider.php
protected function getClientInitializer(Application $app, $prefix)
    {
        return $app->protect(function ($args) use ($app, $prefix) {
            $extract = function ($bag, $key) use ($app, $prefix) {
                $default = "default_$key";
                if ($bag instanceof Application) {
                    $key = "$prefix.$key";
                    var_dump($key);
                }
                if (!isset($bag[$key])) {
                    return $app["$prefix.$default"];
                }
                if (is_array($bag[$key])) {
                    return array_merge($app["$prefix.$default"], $bag[$key]);
                }
                return $bag[$key];
            };
            if (isset($args['parameters']) && is_string($args['parameters'])) {
                $args['parameters'] = $app["$prefix.uri_parser"]($args['parameters']);
            }
            $parameters = $extract($args, 'parameters');
            $options = $extract($args, 'options');

            return $app["$prefix.client_constructor"]($parameters, $options);
        });
    }
protected function getClientInitializer(Application $app, $prefix)
    {
        return $app->protect(function ($args) use ($app, $prefix) {
            $extract = function ($bag, $key) use ($app, $prefix) {
                $default = "default_$key";
                if ($bag instanceof Application) {
                    $key = "$prefix.$key";
                    var_dump($key);
                }
                if (!isset($bag[$key])) {
                    return $app["$prefix.$default"];
                }
                if (is_array($bag[$key])) {
                    return array_merge($app["$prefix.$default"], $bag[$key]);
                }
                return $bag[$key];
            };
            if (isset($args['parameters']) && is_string($args['parameters'])) {
                $args['parameters'] = $app["$prefix.uri_parser"]($args['parameters']);
            }
            $parameters = $extract($args, 'parameters');
            $options = $extract($args, 'options');

            return $app["$prefix.client_constructor"]($parameters, $options);
        });
    }
protected function getClientInitializer ( Application $ app , $ prefix ) { return $ app -> protect ( function ( $ args ) use ( $ app , $ prefix ) { $ extract = function ( $ bag , $ key ) use ( $ app , $ prefix ) { $ default = "default_$key" ; if ( $ bag instanceof Application ) { $ key = "$prefix.$key" ; var_dump ( $ key ) ; } if ( ! isset ( $ bag [ $ key ] ) ) { return $ app [ "$prefix.$default" ] ; } if ( is_array ( $ bag [ $ key ] ) ) { return array_merge ( $ app [ "$prefix.$default" ] , $ bag [ $ key ] ) ; } return $ bag [ $ key ] ; } ; if ( isset ( $ args [ 'parameters' ] ) && is_string ( $ args [ 'parameters' ] ) ) { $ args [ 'parameters' ] = $ app [ "$prefix.uri_parser" ] ( $ args [ 'parameters' ] ) ; } $ parameters = $ extract ( $ args , 'parameters' ) ; $ options = $ extract ( $ args , 'options' ) ; return $ app [ "$prefix.client_constructor" ] ( $ parameters , $ options ) ; } ) ; }
Returns an anonymous function used by the service provider initialize
lazily new instances of Redis\Client.

@param Application $app
@param string      $prefix

@return \Closure
Returns an anonymous function used by the service provider initialize lazily new instances of Redis \ Client .