Predis\Connection\StreamConnection::unixStreamInitializer PHP Method

unixStreamInitializer() protected method

Initializes a UNIX stream resource.
protected unixStreamInitializer ( Predis\Connection\ParametersInterface $parameters ) : resource
$parameters Predis\Connection\ParametersInterface Initialization parameters for the connection.
return resource
    protected function unixStreamInitializer(ParametersInterface $parameters)
    {
        if (!isset($parameters->path)) {
            throw new \InvalidArgumentException('Missing UNIX domain socket path.');
        }
        $flags = STREAM_CLIENT_CONNECT;
        if (isset($parameters->persistent)) {
            if (false !== ($persistent = filter_var($parameters->persistent, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))) {
                $flags |= STREAM_CLIENT_PERSISTENT;
                if ($persistent === null) {
                    throw new \InvalidArgumentException('Persistent connection IDs are not supported when using UNIX domain sockets.');
                }
            }
        }
        $resource = $this->createStreamSocket($parameters, "unix://{$parameters->path}", $flags);
        return $resource;
    }