$object = new myCRED_Point_Type();

Codex / mycred/balance / Objects / myCRED_Point_Type

Description

This object holds the format and name of a given point type that has been setup in myCRED.

Available since version 1.7

Properties

Note that the constructor class will auto populate these values when the class is constructed.

Property Type Description
myCRED_Point_Type Object (
cred_id string The point type key.
singular string The point types given name in singular form.
plural string The point types given name in plural form.
prefix string The set prefix for this point type (if used).
suffix string The set suffix for this point type (if used).
format array An associated array about the format set for this point type. this includes:
  • type The type format used in the database. Bigint or decimal.
  • decimals The number of decimal places used for this point type.
  • separators An array containing the decimal and thousand separators.
)

Methods

Variable Type Required Description
class myCRED_Point_Type extends myCRED_Object {
function __construct( $type = '', $mycred = NULL ) {
$type string Yes The point type key to return.
$mycred object No The myCRED_Settings class object, if available.
}
public function number( $number ) {
$number int or float Yes A string value that is to be converted into an int or float based on the point type setup.
}
public function format( $number ) {
$number int or float Yes A point value to format with prefix / suffix based on the point type setup.
}
}

Object Example

myCRED_Point_Type Object
(
    [cred_id] => mycred_deed
    [singular] => Deed
    [plural] => Deeds
    [prefix] => 
    [suffix] => de.
    [format] => Array
        (
            [type] => bigint
            [decimals] => 0
            [separators] => Array
                (
                    [decimal] => .
                    [thousand] => ,
                )

        )

)

Last edited June 23, 2016