Documentation

PropertyBag
in package
implements ArrayAccess

Tags
class

This class provides getters and setters for arguments needed by CRM_Core_Payment methods.

The setters know how to validate each setting that they are responsible for.

Different methods need different settings and the concept is that by passing in a property bag we can encapsulate the params needed for a particular method call, rather than setting arguments for different methods on the main CRM_Core_Payment object.

This class is also supposed to help with transition away from array key naming nightmares.

Table of Contents

Interfaces

ArrayAccess

Properties

$ignoreDeprecatedWarningsInFunction  : string
For unit tests only. Set to the name of a function, e.g. setBillingCountry to suppress calling CRM_Core_Error::deprecatedWarning which will break tests.
$lastWarning  : string
Just for unit testing.
$logs  : array<string|int, mixed>
For unit tests only.
$propMap  : mixed
$props  : mixed
$suppressLegacyWarnings  : bool

Methods

cast()  : PropertyBag
Get the property bag.
getAmount()  : mixed
Get the monetary amount.
getBillingCity()  : string
BillingCity getter.
getBillingCountry()  : string
BillingCountry getter.
getBillingCounty()  : string
BillingCounty getter.
getBillingPostalCode()  : string
BillingPostalCode getter.
getBillingStateProvince()  : string
BillingStateProvince getter.
getBillingStreetAddress()  : string
BillingStreetAddress getter.
getBillingSupplementalAddress1()  : string
BillingSupplementalAddress1 getter.
getBillingSupplementalAddress2()  : string
BillingSupplementalAddress2 getter.
getBillingSupplementalAddress3()  : string
BillingSupplementalAddress3 getter.
getContactID()  : int
getContributionID()  : int|null
Getter for contributionID.
getContributionRecurID()  : int|null
Getter for contributionRecurID.
getCurrency()  : mixed
Three character currency code.
getCustomProperty()  : mixed
Sometimes we may need to pass in things that are specific to the Payment Processor.
getDescription()  : string
getEmail()  : string
Email getter.
getFeeAmount()  : float
Amount of money charged in fees by the payment processor.
getFirstName()  : string
First name
getInvoiceID()  : string|null
Getter for invoiceID.
getIsBackOffice()  : bool|null
Getter for isBackOffice.
getIsNotifyProcessorOnCancelRecur()  : PropertyBag
Get whether the user has selected to notify the processor of a cancellation request.
getIsRecur()  : bool
Getter for isRecur.
getLastName()  : string
Last name
getPaymentToken()  : string|null
Getter for payment processor generated string for charging.
getPhone()  : string
Phone getter.
getRecurFrequencyInterval()  : int|null
Combined with recurFrequencyUnit this gives how often billing will take place.
getRecurFrequencyUnit()  : string
Getter for recurFrequencyUnit.
getRecurInstallments()  : int
getRecurProcessorID()  : string|null
Set the unique payment processor service provided ID for a particular subscription.
getSuppressLegacyWarnings()  : bool
Get the value of the suppressLegacyWarnings parameter
getter()  : mixed
Get a property by its name (but still using its getter).
getTransactionID()  : string|null
Getter for payment processor generated string for the transaction ID.
getTrxnResultCode()  : string|null
Getter for trxnResultCode.
has()  : mixed
mergeLegacyInputParams()  : mixed
This is used to merge values from an array.
offsetExists()  : bool
Implements ArrayAccess::offsetExists
offsetGet()  : mixed
Implements ArrayAccess::offsetGet
offsetSet()  : void
Implements ArrayAccess::offsetSet
offsetUnset()  : void
Implements ArrayAccess::offsetUnset
require()  : PropertyBag
Throw an exception if any of the props is unset.
setAmount()  : mixed
Set the monetary amount.
setBillingCity()  : PropertyBag
BillingCity setter.
setBillingCountry()  : mixed
BillingCountry setter.
setBillingCounty()  : mixed
BillingCounty setter.
setBillingPostalCode()  : mixed
BillingPostalCode setter.
setBillingStateProvince()  : mixed
BillingStateProvince setter.
setBillingStreetAddress()  : mixed
BillingStreetAddress setter.
setBillingSupplementalAddress1()  : mixed
BillingSupplementalAddress1 setter.
setBillingSupplementalAddress2()  : mixed
BillingSupplementalAddress2 setter.
setBillingSupplementalAddress3()  : mixed
BillingSupplementalAddress3 setter.
setContactID()  : mixed
setContributionID()  : mixed
setContributionRecurID()  : PropertyBag
setCurrency()  : mixed
Three character currency code.
setCustomProperty()  : mixed
We have to leave validation to the processor, but we can still give them a way to store their data on this PropertyBag
setDescription()  : mixed
setEmail()  : mixed
Email setter.
setFeeAmount()  : mixed
setFirstName()  : mixed
First name setter.
setInvoiceID()  : mixed
setIsBackOffice()  : mixed
setIsNotifyProcessorOnCancelRecur()  : PropertyBag
Set whether the user has selected to notify the processor of a cancellation request.
setIsRecur()  : mixed
setLastName()  : mixed
Last name setter.
setPaymentToken()  : mixed
setPhone()  : mixed
Phone setter.
setRecurFrequencyInterval()  : mixed
setRecurFrequencyUnit()  : mixed
setRecurInstallments()  : PropertyBag
setRecurProcessorID()  : PropertyBag
Set the unique payment processor service provided ID for a particular subscription.
setSuppressLegacyWarnings()  : mixed
Set the suppressLegacyWarnings parameter - useful for unit tests.
setter()  : mixed
Set a property by its name (but still using its setter).
setTransactionID()  : mixed
setTrxnResultCode()  : mixed
coercePseudoConstantStringToInt()  : mixed
DRY code.
get()  : mixed
Internal getter.
handleLegacyPropNames()  : string
set()  : PropertyBag
Internal setter.

Properties

$ignoreDeprecatedWarningsInFunction

For unit tests only. Set to the name of a function, e.g. setBillingCountry to suppress calling CRM_Core_Error::deprecatedWarning which will break tests.

public string $ignoreDeprecatedWarningsInFunction = ''

Useful when a test is testing THAT a deprecatedWarning is thrown.

$lastWarning

Just for unit testing.

public string $lastWarning

$logs

For unit tests only.

public array<string|int, mixed> $logs = []

$propMap

protected static mixed $propMap = ['amount' => TRUE, 'billingStreetAddress' => TRUE, 'billing_street_address' => 'billingStreetAddress', 'street_address' => 'billingStreetAddress', 'billingSupplementalAddress1' => TRUE, 'billingSupplementalAddress2' => TRUE, 'billingSupplementalAddress3' => TRUE, 'billingCity' => TRUE, 'billing_city' => 'billingCity', 'city' => 'billingCity', 'billingPostalCode' => TRUE, 'billing_postal_code' => 'billingPostalCode', 'postal_code' => 'billingPostalCode', 'billingCounty' => TRUE, 'billingStateProvince' => TRUE, 'billing_state_province' => 'billingStateProvince', 'state_province' => 'billingStateProvince', 'billingCountry' => TRUE, 'billing_country' => 'billingCountry', 'country' => 'billingCountry', 'contactID' => TRUE, 'contact_id' => 'contactID', 'contributionID' => TRUE, 'contribution_id' => 'contributionID', 'contributionRecurID' => TRUE, 'contribution_recur_id' => 'contributionRecurID', 'currency' => TRUE, 'currencyID' => 'currency', 'description' => TRUE, 'email' => TRUE, 'feeAmount' => TRUE, 'fee_amount' => 'feeAmount', 'first_name' => 'firstName', 'firstName' => TRUE, 'invoiceID' => TRUE, 'invoice_id' => 'invoiceID', 'isBackOffice' => TRUE, 'is_back_office' => 'isBackOffice', 'isRecur' => TRUE, 'is_recur' => 'isRecur', 'last_name' => 'lastName', 'lastName' => TRUE, 'paymentToken' => TRUE, 'payment_token' => 'paymentToken', 'phone' => TRUE, 'recurFrequencyInterval' => TRUE, 'frequency_interval' => 'recurFrequencyInterval', 'recurFrequencyUnit' => TRUE, 'frequency_unit' => 'recurFrequencyUnit', 'recurInstallments' => TRUE, 'installments' => 'recurInstallments', 'subscriptionId' => 'recurProcessorID', 'recurProcessorID' => TRUE, 'transactionID' => TRUE, 'transaction_id' => 'transactionID', 'trxn_id' => 'transactionID', 'trxnResultCode' => TRUE, 'isNotifyProcessorOnCancelRecur' => TRUE]

$suppressLegacyWarnings

protected bool $suppressLegacyWarnings = TRUE

Temporary, internal variable to help ease transition to PropertyBag. Used by cast() to suppress legacy warnings. For paymentprocessors that have not converted to propertyBag we need to support "legacy" properties - eg. "is_recur" without warnings. Setting this allows us to pass a propertyBag into doPayment() and expect it to "work" with existing payment processors.

Methods

cast()

Get the property bag.

public static cast(PropertyBag|array<string|int, mixed> $params) : PropertyBag

This allows us to swap a 'might be an array might be a property bag' variable for a known PropertyBag.

Parameters
$params : PropertyBag|array<string|int, mixed>
Return values
PropertyBag

getAmount()

Get the monetary amount.

public getAmount([mixed $label = 'default' ]) : mixed
Parameters
$label : mixed = 'default'

getBillingCity()

BillingCity getter.

public getBillingCity([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getBillingCountry()

BillingCountry getter.

public getBillingCountry([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getBillingCounty()

BillingCounty getter.

public getBillingCounty([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getBillingPostalCode()

BillingPostalCode getter.

public getBillingPostalCode([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getBillingStateProvince()

BillingStateProvince getter.

public getBillingStateProvince([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getBillingStreetAddress()

BillingStreetAddress getter.

public getBillingStreetAddress([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getBillingSupplementalAddress1()

BillingSupplementalAddress1 getter.

public getBillingSupplementalAddress1([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getBillingSupplementalAddress2()

BillingSupplementalAddress2 getter.

public getBillingSupplementalAddress2([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getBillingSupplementalAddress3()

BillingSupplementalAddress3 getter.

public getBillingSupplementalAddress3([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getContactID()

public getContactID([mixed $label = 'default' ]) : int
Parameters
$label : mixed = 'default'
Return values
int

getContributionID()

Getter for contributionID.

public getContributionID([string $label = 'default' ]) : int|null
Parameters
$label : string = 'default'
Return values
int|null

getContributionRecurID()

Getter for contributionRecurID.

public getContributionRecurID([string $label = 'default' ]) : int|null
Parameters
$label : string = 'default'
Return values
int|null

getCurrency()

Three character currency code.

public getCurrency([string $label = 'default' ]) : mixed

https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3

Parameters
$label : string = 'default'

e.g. 'default'

getCustomProperty()

Sometimes we may need to pass in things that are specific to the Payment Processor.

public getCustomProperty(string $prop[, string $label = 'default' ]) : mixed
Parameters
$prop : string
$label : string = 'default'

e.g. 'default' or 'old' or 'new'

Tags
throws
InvalidArgumentException

if trying to use this against a non-custom property.

getDescription()

public getDescription([string $label = 'default' ]) : string
Parameters
$label : string = 'default'
Return values
string

getEmail()

Email getter.

public getEmail([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getFeeAmount()

Amount of money charged in fees by the payment processor.

public getFeeAmount([string $label = 'default' ]) : float

This is notified by (some) payment processers.

Parameters
$label : string = 'default'
Return values
float

getFirstName()

First name

public getFirstName([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getInvoiceID()

Getter for invoiceID.

public getInvoiceID([string $label = 'default' ]) : string|null
Parameters
$label : string = 'default'
Return values
string|null

getIsBackOffice()

Getter for isBackOffice.

public getIsBackOffice([string $label = 'default' ]) : bool|null
Parameters
$label : string = 'default'
Return values
bool|null

getIsNotifyProcessorOnCancelRecur()

Get whether the user has selected to notify the processor of a cancellation request.

public getIsNotifyProcessorOnCancelRecur([string $label = 'default' ]) : PropertyBag

When cancelling the user may be presented with an option to notify the processor. The payment processor can take their response, if present, into account.

Parameters
$label : string = 'default'

e.g. 'default'

Return values
PropertyBag

getIsRecur()

Getter for isRecur.

public getIsRecur([string $label = 'default' ]) : bool
Parameters
$label : string = 'default'
Return values
bool

getLastName()

Last name

public getLastName([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getPaymentToken()

Getter for payment processor generated string for charging.

public getPaymentToken([string $label = 'default' ]) : string|null

A payment token could be a single use token (e.g generated by a client side script) or a token that permits recurring or on demand charging.

The key thing is it is passed to the processor in lieu of card details to initiate a payment.

Generally if a processor is going to pass in a payment token generated through javascript it would add 'payment_token' to the array it returns in it's implementation of getPaymentFormFields. This will add a hidden 'payment_token' field to the form. A good example is client side encryption where credit card details are replaced by an encrypted token using a gateway provided javascript script. In this case the javascript will remove the credit card details from the form before submitting and populate the payment_token field.

A more complex example is used by paypal checkout where the payment token is generated via a pre-approval process. In that case the doPreApproval function is called on the processor class to get information to then interact with paypal via js, finally getting a payment token. (at this stage the pre-approve api is not in core but that is likely to change - we just need to think about the permissions since we don't want to expose to anonymous user without thinking through any risk of credit-card testing using it.

If the token is not totally transient it would be saved to civicrm_payment_token.token.

Parameters
$label : string = 'default'
Return values
string|null

getPhone()

Phone getter.

public getPhone([mixed $label = 'default' ]) : string
Parameters
$label : mixed = 'default'
Return values
string

getRecurFrequencyInterval()

Combined with recurFrequencyUnit this gives how often billing will take place.

public getRecurFrequencyInterval([mixed $label = 'default' ]) : int|null

e.g every if this is 1 and recurFrequencyUnit is 'month' then it is every 1 month.

Parameters
$label : mixed = 'default'
Return values
int|null

getRecurFrequencyUnit()

Getter for recurFrequencyUnit.

public getRecurFrequencyUnit([string $label = 'default' ]) : string

Combined with recurFrequencyInterval this gives how often billing will take place.

e.g every if this is 'month' and recurFrequencyInterval is 1 then it is every 1 month.

Parameters
$label : string = 'default'
Return values
string

month|day|year

getRecurInstallments()

public getRecurInstallments([string $label = 'default' ]) : int
Parameters
$label : string = 'default'
Return values
int

getRecurProcessorID()

Set the unique payment processor service provided ID for a particular subscription.

public getRecurProcessorID([string $label = 'default' ]) : string|null

Nb. this is stored in civicrm_contribution_recur.processor_id and is NOT in any way related to the payment processor ID.

Parameters
$label : string = 'default'
Return values
string|null

getSuppressLegacyWarnings()

Get the value of the suppressLegacyWarnings parameter

public getSuppressLegacyWarnings() : bool
Return values
bool

getter()

Get a property by its name (but still using its getter).

public getter(string $prop[, bool $allowUnset = FALSE ][, mixed $default = NULL ][, string $label = 'default' ]) : mixed
Parameters
$prop : string

valid property name, like contactID

$allowUnset : bool = FALSE

If TRUE, return the default value if the property is not set - normal behaviour would be to throw an exception.

$default : mixed = NULL
$label : string = 'default'

e.g. 'default' or 'old' or 'new'

getTransactionID()

Getter for payment processor generated string for the transaction ID.

public getTransactionID([string $label = 'default' ]) : string|null

Note some gateways generate a reference for the order and one for the payment. This is for the payment reference and is saved to civicrm_financial_trxn.trxn_id.

Parameters
$label : string = 'default'
Return values
string|null

getTrxnResultCode()

Getter for trxnResultCode.

public getTrxnResultCode([string $label = 'default' ]) : string|null

Additional information returned by the payment processor regarding the payment outcome.

This would normally be saved in civicrm_financial_trxn.trxn_result_code.

Parameters
$label : string = 'default'
Return values
string|null

has()

public has(mixed $prop[, mixed $label = 'default' ]) : mixed
Parameters
$prop : mixed
$label : mixed = 'default'

mergeLegacyInputParams()

This is used to merge values from an array.

public mergeLegacyInputParams(array<string|int, mixed> $data) : mixed

It's a transitional, internal function and should not be used!

Parameters
$data : array<string|int, mixed>

offsetExists()

Implements ArrayAccess::offsetExists

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

TRUE if we have that value (on our default store)

offsetGet()

Implements ArrayAccess::offsetGet

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed
Attributes
#[ReturnTypeWillChange]

offsetSet()

Implements ArrayAccess::offsetSet

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed

offsetUnset()

Implements ArrayAccess::offsetUnset

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

require()

Throw an exception if any of the props is unset.

public require(array<string|int, mixed> $props) : PropertyBag
Parameters
$props : array<string|int, mixed>

Array of proper property names (no legacy aliases allowed).

Return values
PropertyBag

setAmount()

Set the monetary amount.

public setAmount(string|float|int $value[, string $label = 'default' ]) : mixed
  • We expect to be called with a string amount with optional decimals using a '.' as the decimal point (not a ',').

  • We're ok with floats/ints being passed in, too, but we'll cast them to a string.

  • Negatives are fine.

Parameters
$value : string|float|int
$label : string = 'default'
Tags
see
https://github.com/civicrm/civicrm-core/pull/18219

setBillingCity()

BillingCity setter.

public setBillingCity(string $input[, string $label = 'default' ]) : PropertyBag
Parameters
$input : string
$label : string = 'default'

e.g. 'default'

Return values
PropertyBag

setBillingCountry()

BillingCountry setter.

public setBillingCountry(string $input[, string $label = 'default' ]) : mixed

Nb. We require and we store a 2 character country code.

Parameters
$input : string
$label : string = 'default'

e.g. 'default'

setBillingCounty()

BillingCounty setter.

public setBillingCounty(string $input[, string $label = 'default' ]) : mixed

Nb. we can't validate this unless we have the country ID too, so we don't.

Parameters
$input : string
$label : string = 'default'

e.g. 'default'

setBillingPostalCode()

BillingPostalCode setter.

public setBillingPostalCode(string $input[, string $label = 'default' ]) : mixed
Parameters
$input : string
$label : string = 'default'

e.g. 'default'

setBillingStateProvince()

BillingStateProvince setter.

public setBillingStateProvince(string $input[, string $label = 'default' ]) : mixed

Nb. we can't validate this unless we have the country ID too, so we don't.

Parameters
$input : string
$label : string = 'default'

e.g. 'default'

setBillingStreetAddress()

BillingStreetAddress setter.

public setBillingStreetAddress(string $input[, string $label = 'default' ]) : mixed
Parameters
$input : string
$label : string = 'default'

e.g. 'default'

setBillingSupplementalAddress1()

BillingSupplementalAddress1 setter.

public setBillingSupplementalAddress1(string $input[, string $label = 'default' ]) : mixed
Parameters
$input : string
$label : string = 'default'

e.g. 'default'

setBillingSupplementalAddress2()

BillingSupplementalAddress2 setter.

public setBillingSupplementalAddress2(string $input[, string $label = 'default' ]) : mixed
Parameters
$input : string
$label : string = 'default'

e.g. 'default'

setBillingSupplementalAddress3()

BillingSupplementalAddress3 setter.

public setBillingSupplementalAddress3(string $input[, string $label = 'default' ]) : mixed
Parameters
$input : string
$label : string = 'default'

e.g. 'default'

setContactID()

public setContactID(int $contactID[, string $label = 'default' ]) : mixed
Parameters
$contactID : int
$label : string = 'default'

setContributionID()

public setContributionID(int $contributionID[, string $label = 'default' ]) : mixed
Parameters
$contributionID : int
$label : string = 'default'

e.g. 'default'

setContributionRecurID()

public setContributionRecurID(int $contributionRecurID[, string $label = 'default' ]) : PropertyBag
Parameters
$contributionRecurID : int
$label : string = 'default'

e.g. 'default'

Return values
PropertyBag

setCurrency()

Three character currency code.

public setCurrency(string $value[, string $label = 'default' ]) : mixed
Parameters
$value : string
$label : string = 'default'

e.g. 'default'

setCustomProperty()

We have to leave validation to the processor, but we can still give them a way to store their data on this PropertyBag

public setCustomProperty(string $prop, mixed $value[, string $label = 'default' ]) : mixed
Parameters
$prop : string
$value : mixed
$label : string = 'default'

e.g. 'default' or 'old' or 'new'

Tags
throws
InvalidArgumentException

if trying to use this against a non-custom property.

setDescription()

public setDescription(string $description[, string $label = 'default' ]) : mixed
Parameters
$description : string
$label : string = 'default'

e.g. 'default'

setEmail()

Email setter.

public setEmail(string $email[, string $label = 'default' ]) : mixed
Parameters
$email : string
$label : string = 'default'

e.g. 'default'

setFeeAmount()

public setFeeAmount(string $feeAmount[, string $label = 'default' ]) : mixed
Parameters
$feeAmount : string
$label : string = 'default'

e.g. 'default'

setFirstName()

First name setter.

public setFirstName(string $firstName[, string $label = 'default' ]) : mixed
Parameters
$firstName : string
$label : string = 'default'

e.g. 'default'

setInvoiceID()

public setInvoiceID(string $invoiceID[, string $label = 'default' ]) : mixed
Parameters
$invoiceID : string
$label : string = 'default'

e.g. 'default'

setIsBackOffice()

public setIsBackOffice(bool $isBackOffice[, string $label = 'default' ]) : mixed
Parameters
$isBackOffice : bool
$label : string = 'default'

e.g. 'default'

setIsNotifyProcessorOnCancelRecur()

Set whether the user has selected to notify the processor of a cancellation request.

public setIsNotifyProcessorOnCancelRecur(bool $value[, string $label = 'default' ]) : PropertyBag

When cancelling the user may be presented with an option to notify the processor. The payment processor can take their response, if present, into account.

Parameters
$value : bool
$label : string = 'default'

e.g. 'default'

Return values
PropertyBag

setIsRecur()

public setIsRecur(bool $isRecur[, string $label = 'default' ]) : mixed
Parameters
$isRecur : bool
$label : string = 'default'

e.g. 'default'

setLastName()

Last name setter.

public setLastName(string $lastName[, string $label = 'default' ]) : mixed
Parameters
$lastName : string
$label : string = 'default'

e.g. 'default'

setPaymentToken()

public setPaymentToken(string $paymentToken[, string $label = 'default' ]) : mixed
Parameters
$paymentToken : string
$label : string = 'default'

e.g. 'default'

setPhone()

Phone setter.

public setPhone(string $phone[, string $label = 'default' ]) : mixed
Parameters
$phone : string
$label : string = 'default'

e.g. 'default'

setRecurFrequencyInterval()

public setRecurFrequencyInterval(int $recurFrequencyInterval[, string $label = 'default' ]) : mixed
Parameters
$recurFrequencyInterval : int
$label : string = 'default'

e.g. 'default'

setRecurFrequencyUnit()

public setRecurFrequencyUnit(string $recurFrequencyUnit[, string $label = 'default' ]) : mixed
Parameters
$recurFrequencyUnit : string

month|day|week|year

$label : string = 'default'

e.g. 'default'

setRecurProcessorID()

Set the unique payment processor service provided ID for a particular subscription.

public setRecurProcessorID(string|null $input[, string $label = 'default' ]) : PropertyBag

See https://github.com/civicrm/civicrm-core/pull/17292 for discussion of how this function accepting NULL fits with standard / planned behaviour.

Parameters
$input : string|null
$label : string = 'default'

e.g. 'default'

Return values
PropertyBag

setSuppressLegacyWarnings()

Set the suppressLegacyWarnings parameter - useful for unit tests.

public setSuppressLegacyWarnings(bool $suppressLegacyWarnings) : mixed

Eg. you could set to FALSE for unit tests on a paymentprocessor to capture use of legacy keys in that processor code.

Parameters
$suppressLegacyWarnings : bool

setter()

Set a property by its name (but still using its setter).

public setter(string $prop[, mixed $value = NULL ][, string $label = 'default' ]) : mixed
Parameters
$prop : string

valid property name, like contactID

$value : mixed = NULL
$label : string = 'default'

e.g. 'default' or 'old' or 'new'

setTransactionID()

public setTransactionID(string $transactionID[, string $label = 'default' ]) : mixed
Parameters
$transactionID : string
$label : string = 'default'

e.g. 'default'

setTrxnResultCode()

public setTrxnResultCode(string $trxnResultCode[, string $label = 'default' ]) : mixed
Parameters
$trxnResultCode : string
$label : string = 'default'

e.g. 'default'

coercePseudoConstantStringToInt()

DRY code.

protected coercePseudoConstantStringToInt(string $baoName, string $field, mixed $input) : mixed
Parameters
$baoName : string
$field : string
$input : mixed

get()

Internal getter.

protected get(mixed $prop, string $label) : mixed
Parameters
$prop : mixed

Valid property name

$label : string

e.g. 'default'

handleLegacyPropNames()

protected handleLegacyPropNames(string $prop[, bool $silent = FALSE ]) : string
Parameters
$prop : string
$silent : bool = FALSE

if TRUE return NULL instead of throwing an exception. This is because offsetExists should be safe and not throw exceptions.

Tags
throws
InvalidArgumentException

if prop name not known.

Return values
string

canonical name.

set()

Internal setter.

protected set(mixed $prop, string $label, mixed $value) : PropertyBag
Parameters
$prop : mixed

Valid property name

$label : string

e.g. 'default'

$value : mixed
Return values
PropertyBag

$this object so you can chain set setters.


        
On this page

Search results