Predis\Client::sharedContextFactory PHP Method

sharedContextFactory() private method

Executes the specified initializer method on $this by adjusting the actual invokation depending on the arity (0, 1 or 2 arguments). This is simply an utility method to create Redis contexts instances since they follow a common initialization path.
private sharedContextFactory ( string $initializer, array $argv = null ) : mixed
$initializer string Method name.
$argv array Arguments for the method.
return mixed
    private function sharedContextFactory($initializer, $argv = null)
    {
        switch (count($argv)) {
            case 0:
                return $this->{$initializer}();
            case 1:
                return is_array($argv[0]) ? $this->{$initializer}($argv[0]) : $this->{$initializer}(null, $argv[0]);
            case 2:
                list($arg0, $arg1) = $argv;
                return $this->{$initializer}($arg0, $arg1);
                // @codeCoverageIgnoreStart
            // @codeCoverageIgnoreStart
            default:
                return $this->{$initializer}($this, $argv);
        }
        // @codeCoverageIgnoreEnd
    }