A PHP representation of the CQL map datatype

Implements

  • Countable
  • Iterator
  • ArrayAccess

Methods

__construct

( string $keyType, string $valueType )

Creates a new map of a given key and value type.

Parameters:
Name Type Details
$keyType string

one of Cassandra::TYPE_*

$valueType string

one of Cassandra::TYPE_*

string

keyType

( )

Returns key type of this map.

Returns:
Type Details
string

key type, one of Cassandra::TYPE_*

array

keys

( )

Returns all keys in the map as an array.

Returns:
Type Details
array

keys

string

valueType

( )

Returns value type of this map.

Returns:
Type Details
string

value type, one of Cassandra::TYPE_*

array

values

( )

Returns all values in the map as an array.

Returns:
Type Details
array

values

set

( mixed $key, mixed $value )

Sets key/value in the map.

Parameters:
Name Type Details
$key mixed

key

$value mixed

value

mixed

get

( mixed $key )

Gets the value of the key in the map.

Parameters:
Name Type Details
$key mixed

Key

Returns:
Type Details
mixed

Value or null

bool

remove

( mixed $key )

Removes the key from the map.

Parameters:
Name Type Details
$key mixed

Key

Returns:
Type Details
bool

Whether the key was removed or not, e.g. didn’t exist

bool

has

( mixed $key )

Returns whether the key is in the map.

Parameters:
Name Type Details
$key mixed

Key

Returns:
Type Details
bool

Whether the key is in the map or not

int

count

( )

Total number of elements in this map

Returns:
Type Details
int

count

mixed

current

( )

Current value for iteration

Returns:
Type Details
mixed

current value

int

key

( )

Current key for iteration

Returns:
Type Details
int

current key

void

next

( )

Move internal iterator forward

Returns:
Type Details
void
bool

valid

( )

Check whether a current value exists

Returns:
Type Details
bool
void

rewind

( )

Rewind internal iterator

Returns:
Type Details
void
void

offsetSet

( mixed $key, mixed $value )

Sets the value at a given key

Parameters:
Name Type Details
$key mixed

Key to use.

$value mixed

Value to set.

Throws:
Type Details
Exception\InvalidArgumentException

when the type of key or value is wrong

Returns:
Type Details
void
mixed

offsetGet

( mixed $key )

Retrieves the value at a given key

Parameters:
Name Type Details
$key mixed

Key to use.

Throws:
Type Details
Exception\InvalidArgumentException

when the type of key is wrong

Returns:
Type Details
mixed

Value or null

void

offsetUnset

( mixed $key )

Deletes the value at a given key

Parameters:
Name Type Details
$key mixed

Key to use.

Throws:
Type Details
Exception\InvalidArgumentException

when the type of key is wrong

Returns:
Type Details
void
bool

offsetExists

( mixed $key )

Returns whether the value a given key is present

Parameters:
Name Type Details
$key mixed

Key to use.

Throws:
Type Details
Exception\InvalidArgumentException

when the type of key is wrong

Returns:
Type Details
bool

Whether the value at a given key is present