public function Price::subtract in Price 8
Same name and namespace in other branches
- 3.x src/Price.php \Drupal\price\Price::subtract()
- 2.0.x src/Price.php \Drupal\price\Price::subtract()
- 2.x src/Price.php \Drupal\price\Price::subtract()
- 3.0.x src/Price.php \Drupal\price\Price::subtract()
Subtracts the given price from the current price.
Parameters
\Drupal\price\Price $price: The price.
Return value
static The resulting price.
File
- src/
Price.php, line 124
Class
- Price
- Provides a value object for monetary values.
Namespace
Drupal\priceCode
public function subtract(Price $price) {
$this
->assertSameCurrency($this, $price);
$new_number = Calculator::subtract($this->number, $price
->getNumber());
return new static($new_number, $this->currencyCode);
}