Simple container class for connection options.

This class also provides the default values for the connection options and will perform a simple validation of them.
It provides array access to its members.

package ArangoDBClient
since 0.2

 Methods

Set defaults, use options provided by client and validate them

__construct(array $options) 

Parameters

$options

array
  • initial options

Exceptions

\ArangoDBClient\ClientException

Add a new endpoint to the list of endpoints if the endpoint is already in the list, it will not be added again as a side-effect, this method will modify _currentEndpointIndex

addEndpoint(string $endpoint) : void

Parameters

$endpoint

string
  • the endpoint to add

Get all options

getAll() : array

Returns

array- all options as an array

Get the current endpoint to use

getCurrentEndpoint() : string

Returns

string- Endpoint string to connect to

Whether or not we have multiple endpoints to connect to

haveMultipleEndpoints() : boolean

Returns

boolean- true if we have more than one endpoint to connect to

Return the next endpoint from the list of endpoints As a side-effect this function switches to a new endpoint

nextEndpoint() : string

Returns

string- the next endpoint

Check whether an option exists, necessary for ArrayAccess

offsetExists(string $offset) : boolean

Parameters

$offset

string

-name of option

Returns

boolean- true if option exists, false otherwise

Get a specific option, necessary for ArrayAccess

offsetGet(string $offset) : mixed

Parameters

$offset

string
  • name of option

Exceptions

\ArangoDBClient\ClientException

Returns

mixed- value of option, will throw if option is not set

Set and validate a specific option, necessary for ArrayAccess

offsetSet(string $offset, mixed $value) : void

Parameters

$offset

string
  • name of option

$value

mixed
  • value for option

Exceptions

\ArangoDBClient\Exception

Remove an option and validate, necessary for ArrayAccess

offsetUnset(string $offset) : void

Parameters

$offset

string
  • name of option

Exceptions

\ArangoDBClient\Exception

Get the default values for the options

getDefaults() : array
Static

Returns

array- array of default connection options

Initialize and return a memcached cache instance, if option "memcachedServers" is set

getEndpointsCache() : \ArangoDBClient\Memcached

Returns

\ArangoDBClient\Memcached- memcached server instance if configured or null if not

Return the supported authorization types

getSupportedAuthTypes() : array
Static

Returns

array- array with supported authorization types

Return the supported connection types

getSupportedConnectionTypes() : array
Static

Returns

array- array with supported connection types

load and merge connection options from optional Memcached cache into ihe current settings

loadOptionsFromCache() : void

store the updated options in the optional Memcached cache

storeOptionsInCache() : void

Validate the options

validate() : void

Exceptions

\ArangoDBClient\ClientException

 Properties

 

Optional Memcached instance for endpoints caching

$_cache : \ArangoDBClient\Memcached

Default

null
 

The index into the endpoints array that we will connect to (or are currently connected to). This index will be increased in case the currently connected server tells us there is a different leader. We will then simply connect to the new leader, adjusting this index. If we don't know the new leader we will try the next server from the list of endpoints until we find the leader or have tried to often

$_currentEndpointIndex : integer

Default

0
 

The current options

$_values : array

Default

array()

 Constants

 

"allow self-signed" index constant

OPTION_ALLOW_SELF_SIGNED = 'allowSelfSigned' 
 

Authentication password

OPTION_AUTH_PASSWD = 'AuthPasswd' 
 

Authentication type

OPTION_AUTH_TYPE = 'AuthType' 
 

Authentication user name

OPTION_AUTH_USER = 'AuthUser' 
 

Batch flag

OPTION_BATCH = 'Batch' 
 

Batchpart flag

OPTION_BATCHPART = 'BatchPart' 
 

Batch size index constant

OPTION_BATCHSIZE = 'batchSize' 
 

"caFile" index constant

OPTION_CA_FILE = 'caFile' 
 

UTF-8 CHeck Flag

OPTION_CHECK_UTF8_CONFORM = 'CheckUtf8Conform' 
 

ciphers allowed to be used in SSL

OPTION_CIPHERS = 'ciphers' 
 

Connection

OPTION_CONNECTION = 'Connection' 
 

"Create collections if they don't exist" index constant

OPTION_CREATE = 'createCollection' 
 

Database flag

OPTION_DATABASE = 'database' 
 

Delete policy index constant

OPTION_DELETE_POLICY = 'policy' 
 

Endpoint string index constant

OPTION_ENDPOINT = 'endpoint' 
 

Enhanced trace

OPTION_ENHANCED_TRACE = 'enhancedTrace' 
 

Max amount of time (in seconds) that is spent waiting on failover

OPTION_FAILOVER_TIMEOUT = 'failoverTimeout' 
 

Number of servers tried in case of failover if set to 0, then an unlimited amount of servers will be tried

OPTION_FAILOVER_TRIES = 'failoverTries' 
 

Host name string index constant (deprecated, use endpoint instead)

OPTION_HOST = 'host' 
 

Wait for sync index constant

OPTION_IS_SYSTEM = 'isSystem' 
 

Wait for sync index constant

OPTION_IS_VOLATILE = 'isVolatile' 
 

Wait for sync index constant

OPTION_JOURNAL_SIZE = 'journalSize' 
 

Limit index constant

OPTION_LIMIT = 'limit' 
 

Entry for memcached endpoints key

OPTION_MEMCACHED_ENDPOINTS_KEY = 'memcachedEndpointsKey' 
 

Entry for memcached options array

OPTION_MEMCACHED_OPTIONS = 'memcachedOptions' 
 

Entry for memcached persistend id

OPTION_MEMCACHED_PERSISTENT_ID = 'memcachedPersistentId' 
 

Entry for memcached servers array

OPTION_MEMCACHED_SERVERS = 'memcachedServers' 
 

Entry for memcached cache ttl

OPTION_MEMCACHED_TTL = 'memcachedTtl' 
 

Entry for notification callback

OPTION_NOTIFY_CALLBACK = 'notifyCallback' 
 

Port number index constant (deprecated, use endpoint instead)

OPTION_PORT = 'port' 
 

Reconnect flag

OPTION_RECONNECT = 'Reconnect' 
 

Replace policy index constant

OPTION_REPLACE_POLICY = 'policy' 
 

Update revision constant

OPTION_REVISION = 'rev' 
 

Skip index constant

OPTION_SKIP = 'skip' 
 

Timeout value index constant

OPTION_TIMEOUT = 'timeout' 
 

Trace function index constant

OPTION_TRACE = 'trace' 
 

Update keepNull constant

OPTION_UPDATE_KEEPNULL = 'keepNull' 
 

Update policy index constant

OPTION_UPDATE_POLICY = 'policy' 
 

"verify certificates" index constant

OPTION_VERIFY_CERT = 'verifyCert' 
 

"verify certificate host name" index constant

OPTION_VERIFY_CERT_NAME = 'verifyCertName' 
 

Wait for sync index constant

OPTION_WAIT_SYNC = 'waitForSync'