PHP Class Basket

Show file Open project: bcosca/fatfree-core Class Usage Examples

Protected Properties

Property Type Description
$id @}
$item @}
$key @}

Public Methods

Method Description
__construct ( $key = 'basket' ) : void Instantiate class
checkout ( ) : array Check out basket contents
clear ( $key ) : null Delete field
copyfrom ( $var ) : null Hydrate item using hive array variable
copyto ( $key ) : null Populate hive array variable with item contents
count ( ) : integer Return number of items in basket
drop ( ) : null Empty basket
dry ( ) : boolean Return TRUE if current item is empty/undefined
erase ( $key, $val ) : boolean Erase item matching key/value pair
exists ( $key ) : boolean Return TRUE if field is defined
find ( $key = NULL, $val = NULL ) : array Return items that match key/value pair; If no key/value pair specified, return all items
findone ( $key, $val ) : object | FALSE Return first item that matches key/value pair
get ( $key ) : scalar | FALSE Retrieve value of field
load ( $key, $val ) : array Map current item to matching key/value pair
reset ( ) : null Reset cursor
save ( ) : array Save current item
set ( $key, $val ) : scalar | FALSE Assign value to field

Method Details

__construct() public method

Instantiate class
public __construct ( $key = 'basket' ) : void
$key string
return void

checkout() public method

Check out basket contents
public checkout ( ) : array
return array

clear() public method

Delete field
public clear ( $key ) : null
$key string
return null

copyfrom() public method

Hydrate item using hive array variable
public copyfrom ( $var ) : null
$var array|string
return null

copyto() public method

Populate hive array variable with item contents
public copyto ( $key ) : null
$key string
return null

count() public method

Return number of items in basket
public count ( ) : integer
return integer

drop() public method

Empty basket
public drop ( ) : null
return null

dry() public method

Return TRUE if current item is empty/undefined
public dry ( ) : boolean
return boolean

erase() public method

Erase item matching key/value pair
public erase ( $key, $val ) : boolean
$key string
$val mixed
return boolean

exists() public method

Return TRUE if field is defined
public exists ( $key ) : boolean
$key string
return boolean

find() public method

Return items that match key/value pair; If no key/value pair specified, return all items
public find ( $key = NULL, $val = NULL ) : array
$key string
$val mixed
return array

findone() public method

Return first item that matches key/value pair
public findone ( $key, $val ) : object | FALSE
$key string
$val mixed
return object | FALSE

get() public method

Retrieve value of field
public get ( $key ) : scalar | FALSE
$key string
return scalar | FALSE

load() public method

Map current item to matching key/value pair
public load ( $key, $val ) : array
$key string
$val mixed
return array

reset() public method

Reset cursor
public reset ( ) : null
return null

save() public method

Save current item
public save ( ) : array
return array

set() public method

Assign value to field
public set ( $key, $val ) : scalar | FALSE
$key string
$val scalar
return scalar | FALSE

Property Details

$id protected property

@}
protected $id

$item protected property

@}
protected $item

$key protected property

@}
protected $key