class Coupon implements CouponInterface

Class Coupon

Properties

protected int $id
protected string|null $code Coupon code, passed from promotion
protected int|null $usageLimit Maximum number of time coupon can be used, passed from promotion
protected int $numberOfUses Number of times coupon has been used
protected bool|null $used Coupon has been fully used
protected Promotion $promotion Associated promotion
protected User $user Associated user

Methods

getUser()

No description

setUser(User $user)

No description

int
getNumberOfUses()

No description

setNumberOfUses(int $numberOfUses)

No description

useCoupon()

Increase number of uses

int
getId()

Get id

string
getCode()

Get code

setCode(string $code)

Set code

integer
getUsageLimit()

Get usage limit

setUsageLimit(integer $usageLimit)

Set usage limit

integer
getUsed()

Get number of times this coupon has been used

setUsed(integer $used)

Set number of times this coupon has been used

incrementUsed()

Increment usage

getPromotion()

Get associated promotion

setPromotion(PromotionInterface $promotion = null)

Set the associated promotion

bool
isValid()

Is this coupon valid

string
serialize()

(PHP 5 >= 5.1.0)
String representation of object

void
unserialize(string $serialized)

(PHP 5 >= 5.1.0)
Constructs the object

mixed
__clone()

When an object is cloned, PHP 5 will perform a shallow copy of all of the object's properties.

Details

at line 109
User getUser()

Return Value

User

at line 119
Coupon setUser(User $user)

Parameters

User $user

Return Value

Coupon

at line 129
int getNumberOfUses()

Return Value

int

at line 139
Coupon setNumberOfUses(int $numberOfUses)

Parameters

int $numberOfUses

Return Value

Coupon

at line 150
Coupon useCoupon()

Increase number of uses

Return Value

Coupon

at line 166
int getId()

Get id

Return Value

int

at line 174
string getCode()

Get code

Return Value

string

at line 182
CouponInterface setCode(string $code)

Set code

Parameters

string $code

Return Value

CouponInterface

at line 192
integer getUsageLimit()

Get usage limit

Return Value

integer

at line 200
CouponInterface setUsageLimit(integer $usageLimit)

Set usage limit

Parameters

integer $usageLimit

Return Value

CouponInterface

at line 210
integer getUsed()

Get number of times this coupon has been used

Return Value

integer

at line 218
CouponInterface setUsed(integer $used)

Set number of times this coupon has been used

Parameters

integer $used

Return Value

CouponInterface

at line 228
CouponInterface incrementUsed()

Increment usage

Return Value

CouponInterface

at line 238
PromotionInterface getPromotion()

Get associated promotion

Return Value

PromotionInterface

at line 246
CouponInterface setPromotion(PromotionInterface $promotion = null)

Set the associated promotion

Parameters

PromotionInterface $promotion

Return Value

CouponInterface

at line 256
bool isValid()

Is this coupon valid

Return Value

bool

at line 277
string serialize()

(PHP 5 >= 5.1.0)
String representation of object

Return Value

string the string representation of the object or null

at line 297
void unserialize(string $serialized)

(PHP 5 >= 5.1.0)
Constructs the object

Parameters

string $serialized The string representation of the object.

Return Value

void

at line 316
mixed __clone()

When an object is cloned, PHP 5 will perform a shallow copy of all of the object's properties.

Any properties that are references to other variables, will remain references. Once the cloning is complete, if a __clone() method is defined, then the newly created object's __clone() method will be called, to allow any necessary properties that need to be changed. NOT CALLABLE DIRECTLY.

Return Value

mixed