public function Price::__construct in Commerce Core 8.2
Constructs a new Price object.
Parameters
string $number: The number.
string $currency_code: The currency code.
File
- modules/
price/ src/ Price.php, line 36
Class
- Price
- Provides a value object for monetary values.
Namespace
Drupal\commerce_priceCode
public function __construct(string $number, string $currency_code) {
Calculator::assertNumberFormat($number);
$this
->assertCurrencyCodeFormat($currency_code);
$this->number = (string) $number;
$this->currencyCode = strtoupper($currency_code);
}