Price per cycle formatting helper

class Price

Properties summary

Type Property Description
protected $price

Methods summary

Return Type Method Name Description
Price __construct(array $price) Initialise price object
string cycle() Return billing cycle
bool isFree() Is the billing cycle one time?
bool isOneTime() Is the billing cycle one time?
bool isRecurring() Is the billing cycle recurring?
Price setup() Return setup fees
Price price() Return price
array breakdown() Return breakdown pricing info
string toPrefixedString() Format price as a prefixed currency string
string toSuffixedString() Format price as a suffixed string
string toFullString() Format price as a full currency string (prefix, amount and suffix)
string getShortCycle() Get short two-letter version of billing cycle
bool isYearly() Returns true if the price is a yearly price
string cycleInYears() Get billing cycle in year(s)
string yearlyPrice() Get per year price
string cycleInMonths() Get billing cycle in month(s)
string monthlyPrice() Get per month price
string oneTimePrice() Get one time price
string breakdownPrice() Get best available breakdown price
string breakdownPriceNumeric() Get best available breakdown price as a number
float calculatePercentageDifference(float $price, int $decimalPlaces) deprecated Calculate percentage difference between two prices.

Details

Price __construct (array $price)

Initialise price object

Parameters

array $price

Return Value

Price

string cycle ()

Return billing cycle

Return Value

string

bool isFree ()

Is the billing cycle one time?

Return Value

bool

bool isOneTime ()

Is the billing cycle one time?

Return Value

bool

bool isRecurring ()

Is the billing cycle recurring?

Return Value

bool

Price setup ()

Return setup fees

Return Value

Price

Price price ()

Return price

Return Value

Price

array breakdown ()

Return breakdown pricing info

Return Value

array

string toPrefixedString ()

Format price as a prefixed currency string

Return Value

string

string toSuffixedString ()

Format price as a suffixed string

Return Value

string

string toFullString ()

Format price as a full currency string (prefix, amount and suffix)

Return Value

string

string getShortCycle ()

Get short two-letter version of billing cycle

Return Value

string

bool isYearly ()

Returns true if the price is a yearly price

Return Value

bool

string cycleInYears ()

Get billing cycle in year(s)

Return Value

string

string yearlyPrice ()

Get per year price

Return Value

string

string cycleInMonths ()

Get billing cycle in month(s)

Return Value

string

string monthlyPrice ()

Get per month price

Return Value

string

string oneTimePrice ()

Get one time price

Return Value

string

string breakdownPrice ()

Get best available breakdown price

Return Value

string

string breakdownPriceNumeric ()

Get best available breakdown price as a number

Return Value

string

float calculatePercentageDifference (float $price, int $decimalPlaces) deprecated

deprecated Use the Markup object directly

Calculate percentage difference between two prices.

Will return the percentage discount from a given higher amount compared with the monthly amount from the current instantiated object.

Parameters

float $price Higher amount to be calculated against
int $decimalPlaces Number of decimals. Default 0.

Return Value

float