public function Price::__construct in Price 8
Same name and namespace in other branches
- 3.x src/Price.php \Drupal\price\Price::__construct()
- 2.0.x src/Price.php \Drupal\price\Price::__construct()
- 2.x src/Price.php \Drupal\price\Price::__construct()
- 3.0.x src/Price.php \Drupal\price\Price::__construct()
Constructs a new Price object.
Parameters
string $number: The number.
string $currency_code: The currency code.
File
- src/
Price.php, line 36
Class
- Price
- Provides a value object for monetary values.
Namespace
Drupal\priceCode
public function __construct($number, $currency_code) {
Calculator::assertNumberFormat($number);
$this
->assertCurrencyCodeFormat($currency_code);
$this->number = (string) $number;
$this->currencyCode = strtoupper($currency_code);
}