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