PHP Class Elastica\Param

This function can be used to handle params for queries, filter
Author: Nicolas Ruflin ([email protected])
Inheritance: implements elastica\ArrayableInterface
Afficher le fichier Open project: ruflin/elastica Class Usage Examples

Protected Properties

Свойство Type Description
$_params array Params.
$_rawParams array Raw Params.

Méthodes publiques

Méthode Description
addParam ( string $key, mixed $value ) Adds a param to the list.
getParam ( string $key ) : mixed Returns a specific param.
getParams ( ) : array Returns the params array.
hasParam ( string $key ) : boolean Test if a param is set.
setParam ( string $key, mixed $value ) Sets (overwrites) the value at the given key.
setParams ( array $params ) Sets (overwrites) all params of this object.
toArray ( ) : array Converts the params to an array. A default implementation exist to create the an array out of the class name (last part of the class name) and the params.

Méthodes protégées

Méthode Description
_convertArrayable ( array $array ) : array Cast objects to arrays.
_getBaseName ( ) : string Param's name Picks the last part of the class name and makes it snake_case You can override this method if you want to change the name.
_setRawParam ( string $key, mixed $value ) Sets params not inside params array.

Method Details

_convertArrayable() protected méthode

Cast objects to arrays.
protected _convertArrayable ( array $array ) : array
$array array
Résultat array

_getBaseName() protected méthode

Param's name Picks the last part of the class name and makes it snake_case You can override this method if you want to change the name.
protected _getBaseName ( ) : string
Résultat string name

_setRawParam() protected méthode

Sets params not inside params array.
protected _setRawParam ( string $key, mixed $value )
$key string
$value mixed

addParam() public méthode

This function can be used to add an array of params
public addParam ( string $key, mixed $value )
$key string Param key
$value mixed Value to set

getParam() public méthode

Returns a specific param.
public getParam ( string $key ) : mixed
$key string Key to return
Résultat mixed Key value

getParams() public méthode

Returns the params array.
public getParams ( ) : array
Résultat array Params

hasParam() public méthode

Test if a param is set.
public hasParam ( string $key ) : boolean
$key string Key to test
Résultat boolean True if the param is set, false otherwise

setParam() public méthode

Sets (overwrites) the value at the given key.
public setParam ( string $key, mixed $value )
$key string Key to set
$value mixed Key Value

setParams() public méthode

Sets (overwrites) all params of this object.
public setParams ( array $params )
$params array Parameter list

toArray() public méthode

Converts the params to an array. A default implementation exist to create the an array out of the class name (last part of the class name) and the params.
public toArray ( ) : array
Résultat array Filter array

Property Details

$_params protected_oe property

Params.
protected array $_params
Résultat array

$_rawParams protected_oe property

Raw Params.
protected array $_rawParams
Résultat array