The myCRED_Point_Type object holds the structure and formatting of a given point type. It is used to ensure values are formatted correctly and are valid. It is used for both calculations as well as displaying or rendering point values.

Available since version 1.7

Object Properties

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

Property

Type

Description

myCRED_Point_Type Object (

public$cred_id

string

The point type key.

public$singular

string

The point types given name in singular form.

public$plural

string

The point types given name in plural form.

public$prefix

string

The set prefix for this point type (if used).

public$suffix

string

The set suffix for this point type (if used).

public$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.

public$lowest_value

int or float

This is the lowest point value that can be processed based on the format setup.

Returns the lowest amount this point type setup can handle. For point types that use integers, this will be 1 while if using two decimal places, it would be 0.01. Used to ensure myCRED does not attempt to handle partial points.

}

public function number( $number = '' ) {

Description:

Formats a given value based on the format setup used by this point type. A point type that uses decimals will be returned as a float else an integer.

Variable

Type

Required

Description

$number

string

Yes

A value that is to be converted into an int or float based on the point type setup.

}

public function format( $number = '' ) {

Description:

Returns a given value in a string form with separators, prefix or suffix applied. This method should only be used to display values and not for calculations.

myCRED Donations

Donate via PayPal

Donate Bitcoin

3LVrDPjgTkPfqGARXwAZW9cJBQEYo4FHsB

Suggest Codex Example

You can submit suggestions for codex examples that you have available as a public gist. If you are a member on the mycred.me website, you can earn Tokens for each submission. To claim these Tokens, make sure you provide your mycred.me username.

Gist URL

mycred.me Username

Please make sure the example you submit is relevant and if you include documentation, it's provided in English.