PHP 클래스 Cart\Cart

파일 보기 프로젝트 열기: mike182uk/cart 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $id, Cart\Storage\Store $store ) Create a new cart instance.
add ( cart\CartItem $cartItem ) Add an item to the cart.
all ( ) : cart\CartItem[] Retrieve all of the items in the cart.
clear ( ) Remove all items from the cart.
find ( string $itemId ) : cart\CartItem | null Find an item in the cart.
get ( string $itemId ) : cart\CartItem | null Retrieve an item from the cart by its id.
getId ( ) : string Retrieve the cart id.
getStore ( ) : Cart\Storage\Store Retrieve the cart storage implementation.
has ( string $itemId ) : boolean Determine if an item exists in the cart.
remove ( string $itemId ) Remove an item from the cart.
restore ( ) Restore the cart from its saved state.
save ( ) Save the cart state.
tax ( ) : float Get the cart tax.
toArray ( ) : array Export the cart as an array.
total ( ) : float Get the cart total including tax.
totalExcludingTax ( ) : float Get the cart total excluding tax.
totalItems ( ) : integer Get the total number of items in the cart.
totalUniqueItems ( ) : integer Get the total number of unique items in the cart.
update ( string $itemId, string $key, mixed $value ) : string Update an item in the cart.

비공개 메소드들

메소드 설명
restoreCheckContents ( array $data ) Check the contents of the data to be restored contains the correct data.
restoreCheckContentsType ( array $data ) Check the contents of the data to be restored is of the correct type.
restoreCheckType ( mixed $data ) Check the data to be restored is of the correct type.

메소드 상세

__construct() 공개 메소드

Create a new cart instance.
public __construct ( string $id, Cart\Storage\Store $store )
$id string
$store Cart\Storage\Store

add() 공개 메소드

Add an item to the cart.
public add ( cart\CartItem $cartItem )
$cartItem cart\CartItem

all() 공개 메소드

Retrieve all of the items in the cart.
public all ( ) : cart\CartItem[]
리턴 cart\CartItem[]

clear() 공개 메소드

Remove all items from the cart.
public clear ( )

find() 공개 메소드

Find an item in the cart.
public find ( string $itemId ) : cart\CartItem | null
$itemId string
리턴 cart\CartItem | null

get() 공개 메소드

Retrieve an item from the cart by its id.
public get ( string $itemId ) : cart\CartItem | null
$itemId string
리턴 cart\CartItem | null

getId() 공개 메소드

Retrieve the cart id.
public getId ( ) : string
리턴 string

getStore() 공개 메소드

Retrieve the cart storage implementation.
public getStore ( ) : Cart\Storage\Store
리턴 Cart\Storage\Store

has() 공개 메소드

Determine if an item exists in the cart.
public has ( string $itemId ) : boolean
$itemId string
리턴 boolean

remove() 공개 메소드

Remove an item from the cart.
public remove ( string $itemId )
$itemId string

restore() 공개 메소드

Restore the cart from its saved state.
public restore ( )

save() 공개 메소드

Save the cart state.
public save ( )

tax() 공개 메소드

Get the cart tax.
public tax ( ) : float
리턴 float

toArray() 공개 메소드

Export the cart as an array.
public toArray ( ) : array
리턴 array

total() 공개 메소드

Get the cart total including tax.
public total ( ) : float
리턴 float

totalExcludingTax() 공개 메소드

Get the cart total excluding tax.
public totalExcludingTax ( ) : float
리턴 float

totalItems() 공개 메소드

Get the total number of items in the cart.
public totalItems ( ) : integer
리턴 integer

totalUniqueItems() 공개 메소드

Get the total number of unique items in the cart.
public totalUniqueItems ( ) : integer
리턴 integer

update() 공개 메소드

Update an item in the cart.
public update ( string $itemId, string $key, mixed $value ) : string
$itemId string
$key string
$value mixed
리턴 string