PHP Класс Clinner\ValueHolder

Автор: José Nahuel Cuesta Luengo ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( array $initial = [] ) Constructor
__get ( $name ) Overridden in order to allow atribute-like accessor for values in the ValueHolder.
__set ( $name, $value ) Overridden in order to allow atribute-like setter for values in the ValueHolder.
count ( ) : integer Get the number of arguments set to this ValueHolder.
create ( array | ValueHolder $initial = [] ) : ValueHolder Create a new instance of ValueHolder with an optional initial set of values.
get ( string $name, mixed $default = null ) : mixed Get the value stored under key $name if it's set - otherwise return $default.
getAll ( ) : array Get all the values stored in this ValueHolder as an array.
isEmpty ( ) : boolean Answer whether this ValueHolder is empty.
reset ( ) : ValueHolder Reset this ValueHolder's values, clearing any of them.
set ( string $name, mixed $value ) : ValueHolder Set and store a value under key $name to $value.
setAll ( array $values ) : ValueHolder Set all the values stored in this ValueHolder to $values, destroying any previously-set ones.

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

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

Constructor
public __construct ( array $initial = [] )
$initial array (Optional) initial values for the ValueHolder.

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

Overridden in order to allow atribute-like accessor for values in the ValueHolder.
public __get ( $name )

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

Overridden in order to allow atribute-like setter for values in the ValueHolder.
public __set ( $name, $value )

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

Get the number of arguments set to this ValueHolder.
public count ( ) : integer
Результат integer

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

$initial might either be an array or another instance of ValueHolder, in which case it will be returned as is.
public static create ( array | ValueHolder $initial = [] ) : ValueHolder
$initial array | ValueHolder (Optional) initial set of values.
Результат ValueHolder

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

Get the value stored under key $name if it's set - otherwise return $default.
public get ( string $name, mixed $default = null ) : mixed
$name string The key name for the desired value.
$default mixed (Optional) a default value to return if $name is not set.
Результат mixed

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

Get all the values stored in this ValueHolder as an array.
public getAll ( ) : array
Результат array

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

Answer whether this ValueHolder is empty.
public isEmpty ( ) : boolean
Результат boolean

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

Reset this ValueHolder's values, clearing any of them.
public reset ( ) : ValueHolder
Результат ValueHolder This instance, for a fluent API.

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

Set and store a value under key $name to $value.
public set ( string $name, mixed $value ) : ValueHolder
$name string The key name for the value to set.
$value mixed The value to set under key $name.
Результат ValueHolder This instance, for a fluent API.

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

Set all the values stored in this ValueHolder to $values, destroying any previously-set ones.
public setAll ( array $values ) : ValueHolder
$values array The new values to set.
Результат ValueHolder This instance, for a fluent API.