src/Configuration/Option/Aggregate.php
protected function getConnectionInitializer(OptionsInterface $options, $callable)
    {
        if (!is_callable($callable)) {
            $class = get_called_class();

            throw new \InvalidArgumentException("$class expects a valid callable");
        }

        $option = $this;

        return function ($parameters = null) use ($callable, $options, $option) {
            $connection = call_user_func($callable, $options, $parameters);

            if (!$connection instanceof AggregateConnectionInterface) {
                $class = get_class($option);

                throw new \InvalidArgumentException("$class expects a valid connection type returned by callable initializer");
            }

            return $connection;
        };
    }
protected function getConnectionInitializer(OptionsInterface $options, $callable)
    {
        if (!is_callable($callable)) {
            $class = get_called_class();

            throw new \InvalidArgumentException("$class expects a valid callable");
        }

        $option = $this;

        return function ($parameters = null) use ($callable, $options, $option) {
            $connection = call_user_func($callable, $options, $parameters);

            if (!$connection instanceof AggregateConnectionInterface) {
                $class = get_class($option);

                throw new \InvalidArgumentException("$class expects a valid connection type returned by callable initializer");
            }

            return $connection;
        };
    }
protected function getConnectionInitializer ( OptionsInterface $ options , $ callable ) { if ( ! is_callable ( $ callable ) ) { $ class = get_called_class ( ) ; throw new \ InvalidArgumentException ( "$class expects a valid callable" ) ; } $ option = $ this ; return function ( $ parameters = null ) use ( $ callable , $ options , $ option ) { $ connection = call_user_func ( $ callable , $ options , $ parameters ) ; if ( ! $ connection instanceof AggregateConnectionInterface ) { $ class = get_class ( $ option ) ; throw new \ InvalidArgumentException ( "$class expects a valid connection type returned by callable initializer" ) ; } return $ connection ; } ; }
Wraps a callable to ensure that the returned value is a valid connection.

@param OptionsInterface $options  Client options.
@param mixed            $callable Callable initializer.

@return \Closure
Wraps a callable to ensure that the returned value is a valid connection .