PHP Класс Elastica\Connection

Автор: Nicolas Ruflin ([email protected])
Наследование: extends Param
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( array $params = [] ) Creates a new connection object. A connection is enabled by default.
addConfig ( string $key, mixed $value )
create ( Connection | array $params = [] ) : self
getConfig ( string $key = '' ) : array | string Returns a specific config key or the whole config array if not set.
getConnectTimeout ( ) : integer
getHost ( ) : string
getPassword ( ) : string
getPath ( ) : string
getPort ( ) : integer
getProxy ( ) : string | null
getTimeout ( ) : integer
getTransport ( ) : string | array
getTransportObject ( ) : AbstractTransport Returns an instance of the transport type.
getUsername ( ) : string
hasCompression ( ) : boolean
hasConfig ( string $key ) : boolean
isEnabled ( ) : boolean
isPersistent ( ) : boolean
setCompression ( boolean $compression = null )
setConfig ( array $config )
setConnectTimeout ( integer $timeout ) Number of seconds after a connection timeout occurs for every request during the connection phase.
setEnabled ( boolean $enabled = true ) Enables a connection.
setHost ( string $host )
setPath ( string $path )
setPort ( integer $port )
setProxy ( string | null $proxy ) Set proxy for http connections. Null is for environmental proxy, empty string to disable proxy and proxy string to set actual http proxy.
setTimeout ( integer $timeout )
setTransport ( string | array $transport )

Описание методов

__construct() публичный Метод

Creates a new connection object. A connection is enabled by default.
public __construct ( array $params = [] )
$params array OPTIONAL Connection params: host, port, transport, timeout. All are optional

addConfig() публичный Метод

public addConfig ( string $key, mixed $value )
$key string
$value mixed

create() публичный статический Метод

public static create ( Connection | array $params = [] ) : self
$params Connection | array Params to create a connection
Результат self

getConfig() публичный Метод

Returns a specific config key or the whole config array if not set.
public getConfig ( string $key = '' ) : array | string
$key string Config key
Результат array | string Config value

getConnectTimeout() публичный Метод

public getConnectTimeout ( ) : integer
Результат integer Connection timeout in seconds

getHost() публичный Метод

public getHost ( ) : string
Результат string Host

getPassword() публичный Метод

public getPassword ( ) : string
Результат string Password

getPath() публичный Метод

public getPath ( ) : string
Результат string

getPort() публичный Метод

public getPort ( ) : integer
Результат integer Server port

getProxy() публичный Метод

public getProxy ( ) : string | null
Результат string | null Host

getTimeout() публичный Метод

public getTimeout ( ) : integer
Результат integer Connection timeout in seconds

getTransport() публичный Метод

public getTransport ( ) : string | array
Результат string | array

getTransportObject() публичный Метод

Returns an instance of the transport type.
public getTransportObject ( ) : AbstractTransport
Результат Elastica\Transport\AbstractTransport Transport object

getUsername() публичный Метод

public getUsername ( ) : string
Результат string User

hasCompression() публичный Метод

public hasCompression ( ) : boolean
Результат boolean

hasConfig() публичный Метод

public hasConfig ( string $key ) : boolean
$key string
Результат boolean

isEnabled() публичный Метод

public isEnabled ( ) : boolean
Результат boolean True if enabled

isPersistent() публичный Метод

public isPersistent ( ) : boolean
Результат boolean Returns true if connection is persistent. True by default

setCompression() публичный Метод

public setCompression ( boolean $compression = null )
$compression boolean

setConfig() публичный Метод

public setConfig ( array $config )
$config array

setConnectTimeout() публичный Метод

Use a small value if you need a fast fail in case of dead, unresponsive or unreachable servers (~5 sec). Set to zero to switch to the default built-in connection timeout (300 seconds in curl).
См. также: http://curl.haxx.se/libcurl/c/CURLOPT_CONNECTTIMEOUT.html
public setConnectTimeout ( integer $timeout )
$timeout integer Connect timeout in seconds

setEnabled() публичный Метод

Enables a connection.
public setEnabled ( boolean $enabled = true )
$enabled boolean OPTIONAL (default = true)

setHost() публичный Метод

public setHost ( string $host )
$host string

setPath() публичный Метод

public setPath ( string $path )
$path string

setPort() публичный Метод

public setPort ( integer $port )
$port integer

setProxy() публичный Метод

Set proxy for http connections. Null is for environmental proxy, empty string to disable proxy and proxy string to set actual http proxy.
См. также: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY
public setProxy ( string | null $proxy )
$proxy string | null

setTimeout() публичный Метод

public setTimeout ( integer $timeout )
$timeout integer Timeout in seconds

setTransport() публичный Метод

public setTransport ( string | array $transport )
$transport string | array