CartService
in package
Table of Contents
Properties
- $auth : AuthComponent
- $fake : bool
- $purchaseLock : RedisLock|null
- $redis : Redis
- $sessionLock : RedisLock|null
- $shoppingSession : ShoppingSession|null|false
Methods
- __construct() : mixed
- addAddon() : ShoppingSession
- addMultipleSubscriptions() : mixed
- addSubscription() : ShoppingSession
- drop() : bool
- get() : ShoppingSession|null
- getOrThrow() : ShoppingSession
- getPurchaseLock() : RedisLock|null
- getSessionLock() : RedisLock|null
- getShoppingSessionId() : mixed
- init() : ShoppingSession
- initFake() : ShoppingSession
- lockPurchase() : mixed
- lockSession() : mixed
- setCoupons() : mixed
- setOffer() : mixed
- userHasCart() : bool
- commit() : mixed
- getPurchaseLockKey() : mixed
Properties
$auth
private
AuthComponent
$auth
$fake
private
bool
$fake
= false
$purchaseLock
private
RedisLock|null
$purchaseLock
$redis
private
Redis
$redis
$sessionLock
private
RedisLock|null
$sessionLock
$shoppingSession
private
ShoppingSession|null|false
$shoppingSession
Methods
__construct()
public
__construct(AuthComponent $auth, Redis $redis) : mixed
Parameters
- $auth : AuthComponent
- $redis : Redis
addAddon()
public
addAddon(CartAddon $addon) : ShoppingSession
Parameters
- $addon : CartAddon
Return values
ShoppingSessionaddMultipleSubscriptions()
public
addMultipleSubscriptions(mixed $subscriptions) : mixed
Parameters
- $subscriptions : mixed
addSubscription()
public
addSubscription(Subscription $subscription) : ShoppingSession
Parameters
- $subscription : Subscription
Return values
ShoppingSessiondrop()
public
drop() : bool
Return values
boolget()
public
get() : ShoppingSession|null
Return values
ShoppingSession|nullgetOrThrow()
public
getOrThrow() : ShoppingSession
Return values
ShoppingSessiongetPurchaseLock()
public
getPurchaseLock() : RedisLock|null
Return values
RedisLock|nullgetSessionLock()
public
getSessionLock() : RedisLock|null
Return values
RedisLock|nullgetShoppingSessionId()
public
getShoppingSessionId() : mixed
init()
public
init(Client $client, UserAccount $userAccount, Customer $customer) : ShoppingSession
Parameters
- $client : Client
- $userAccount : UserAccount
- $customer : Customer
Return values
ShoppingSessioninitFake()
public
initFake(Client $client, UserAccount $userAccount, Customer $customer) : ShoppingSession
Parameters
- $client : Client
- $userAccount : UserAccount
- $customer : Customer
Return values
ShoppingSessionlockPurchase()
public
lockPurchase([int $ttl = 3000 ]) : mixed
Parameters
- $ttl : int = 3000
lockSession()
public
lockSession([int $ttl = 3000 ]) : mixed
Parameters
- $ttl : int = 3000
setCoupons()
public
setCoupons(array<string|int, mixed> $coupons) : mixed
Parameters
- $coupons : array<string|int, mixed>
setOffer()
public
setOffer(mixed $offer) : mixed
Parameters
- $offer : mixed
userHasCart()
public
userHasCart() : bool
Return values
boolcommit()
private
commit(ShoppingSession $session) : mixed
Parameters
- $session : ShoppingSession
getPurchaseLockKey()
private
getPurchaseLockKey() : mixed