protected function PriceModified::assertSameCurrency in Price 3.x
Same name and namespace in other branches
- 8 src/PriceModified.php \Drupal\price\PriceModified::assertSameCurrency()
- 3.0.x src/PriceModified.php \Drupal\price\PriceModified::assertSameCurrency()
Asserts that the two prices have the same currency.
Parameters
\Drupal\price\PriceModified $first_price: The first price.
\Drupal\price\PriceModified $second_price: The second price.
Throws
\Drupal\price\Exception\CurrencyMismatchException Thrown when the prices do not have the same currency.
3 calls to PriceModified::assertSameCurrency()
- PriceModified::add in src/
PriceModified.php - Adds the given price to the current price.
- PriceModified::compareTo in src/
PriceModified.php - Compares the current price with the given price.
- PriceModified::subtract in src/
PriceModified.php - Subtracts the given price from the current price.
File
- src/
PriceModified.php, line 297
Class
- PriceModified
- Provides a value object for monetary values.
Namespace
Drupal\priceCode
protected function assertSameCurrency(PriceModified $first_price, PriceModified $second_price) {
if ($first_price
->getCurrencyCode() != $second_price
->getCurrencyCode()) {
throw new CurrencyMismatchException();
}
}