You are here

public function PriceModified::__construct in Price 3.x

Same name and namespace in other branches
  1. 8 src/PriceModified.php \Drupal\price\PriceModified::__construct()
  2. 3.0.x src/PriceModified.php \Drupal\price\PriceModified::__construct()

Constructs a new PriceModified object.

Parameters

string $number: The number.

string $currency_code: The currency code.

string $modifier: The modifier.

File

src/PriceModified.php, line 43

Class

PriceModified
Provides a value object for monetary values.

Namespace

Drupal\price

Code

public function __construct($number, $currency_code, $modifier) {
  Calculator::assertNumberFormat($number);
  $this
    ->assertCurrencyCodeFormat($currency_code);
  $this->number = (string) $number;
  $this->currencyCode = strtoupper($currency_code);
  $this->modifier = $modifier;
}