Money
extends Message
in package
Represents an amount of money with its currency type.
Generated from protobuf message google.type.Money
Table of Contents
Properties
- $currency_code : mixed
- The three-letter currency code defined in ISO 4217.
- $nanos : mixed
- Number of nano (10^-9) units of the amount.
- $units : mixed
- The whole units of the amount.
Methods
- __construct() : mixed
- Constructor.
- getCurrencyCode() : string
- The three-letter currency code defined in ISO 4217.
- getNanos() : int
- Number of nano (10^-9) units of the amount.
- getUnits() : int|string
- The whole units of the amount.
- setCurrencyCode() : $this
- The three-letter currency code defined in ISO 4217.
- setNanos() : $this
- Number of nano (10^-9) units of the amount.
- setUnits() : $this
- The whole units of the amount.
Properties
$currency_code
The three-letter currency code defined in ISO 4217.
protected
mixed
$currency_code
= ''
Generated from protobuf field string currency_code = 1 [json_name = "currencyCode"];
$nanos
Number of nano (10^-9) units of the amount.
protected
mixed
$nanos
= 0
The value must be between -999,999,999 and +999,999,999 inclusive.
If units is positive, nanos must be positive or zero.
If units is zero, nanos can be positive, zero, or negative.
If units is negative, nanos must be negative or zero.
For example $-1.75 is represented as units=-1 and nanos=-750,000,000.
Generated from protobuf field int32 nanos = 3 [json_name = "nanos"];
$units
The whole units of the amount.
protected
mixed
$units
= 0
For example if currencyCode is "USD", then 1 unit is one US dollar.
Generated from protobuf field int64 units = 2 [json_name = "units"];
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $data = NULL ]) : mixed
Parameters
- $data : array<string|int, mixed> = NULL
-
{ Optional. Data for populating the Message object.
@type string $currency_code The three-letter currency code defined in ISO 4217. @type int|string $units The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. @type int $nanos Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.}
getCurrencyCode()
The three-letter currency code defined in ISO 4217.
public
getCurrencyCode() : string
Generated from protobuf field string currency_code = 1 [json_name = "currencyCode"];
Return values
stringgetNanos()
Number of nano (10^-9) units of the amount.
public
getNanos() : int
The value must be between -999,999,999 and +999,999,999 inclusive.
If units is positive, nanos must be positive or zero.
If units is zero, nanos can be positive, zero, or negative.
If units is negative, nanos must be negative or zero.
For example $-1.75 is represented as units=-1 and nanos=-750,000,000.
Generated from protobuf field int32 nanos = 3 [json_name = "nanos"];
Return values
intgetUnits()
The whole units of the amount.
public
getUnits() : int|string
For example if currencyCode is "USD", then 1 unit is one US dollar.
Generated from protobuf field int64 units = 2 [json_name = "units"];
Return values
int|stringsetCurrencyCode()
The three-letter currency code defined in ISO 4217.
public
setCurrencyCode(string $var) : $this
Generated from protobuf field string currency_code = 1 [json_name = "currencyCode"];
Parameters
- $var : string
Return values
$thissetNanos()
Number of nano (10^-9) units of the amount.
public
setNanos(int $var) : $this
The value must be between -999,999,999 and +999,999,999 inclusive.
If units is positive, nanos must be positive or zero.
If units is zero, nanos can be positive, zero, or negative.
If units is negative, nanos must be negative or zero.
For example $-1.75 is represented as units=-1 and nanos=-750,000,000.
Generated from protobuf field int32 nanos = 3 [json_name = "nanos"];
Parameters
- $var : int
Return values
$thissetUnits()
The whole units of the amount.
public
setUnits(int|string $var) : $this
For example if currencyCode is "USD", then 1 unit is one US dollar.
Generated from protobuf field int64 units = 2 [json_name = "units"];
Parameters
- $var : int|string