final class PriceCalculatorResult in Commerce Core 8.2
Represents the result of a price calculation.
Hierarchy
- class \Drupal\commerce_order\PriceCalculatorResult
Expanded class hierarchy of PriceCalculatorResult
See also
\Drupal\commerce_order\PriceCalculatorInterface
File
- modules/
order/ src/ PriceCalculatorResult.php, line 12
Namespace
Drupal\commerce_orderView source
final class PriceCalculatorResult {
/**
* The calculated price.
*
* @var \Drupal\commerce_price\Price
*/
protected $calculatedPrice;
/**
* The base price.
*
* @var \Drupal\commerce_price\Price
*/
protected $basePrice;
/**
* The adjustments.
*
* @var \Drupal\commerce_order\Adjustment[]
*/
protected $adjustments;
/**
* Constructs a new PriceCalculatorResult object.
*
* @param \Drupal\commerce_price\Price $calculated_price
* The calculated price.
* @param \Drupal\commerce_price\Price $base_price
* The base price.
* @param \Drupal\commerce_order\Adjustment[] $adjustments
* The adjustments.
*/
public function __construct(Price $calculated_price, Price $base_price, array $adjustments = []) {
$this->calculatedPrice = $calculated_price;
$this->basePrice = $base_price;
$this->adjustments = $adjustments;
}
/**
* Gets the calculated price.
*
* This is the resolved unit price with adjustments applied.
*
* @return \Drupal\commerce_price\Price
* The calculated price.
*/
public function getCalculatedPrice() : Price {
return $this->calculatedPrice;
}
/**
* Gets the base price.
*
* This is the resolved unit price without any adjustments.
*
* @return \Drupal\commerce_price\Price
* The base price.
*/
public function getBasePrice() : Price {
return $this->basePrice;
}
/**
* Gets the adjustments.
*
* @return \Drupal\commerce_order\Adjustment[]
* The adjustments.
*/
public function getAdjustments() : array {
return $this->adjustments;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PriceCalculatorResult:: |
protected | property | The adjustments. | |
PriceCalculatorResult:: |
protected | property | The base price. | |
PriceCalculatorResult:: |
protected | property | The calculated price. | |
PriceCalculatorResult:: |
public | function | Gets the adjustments. | |
PriceCalculatorResult:: |
public | function | Gets the base price. | |
PriceCalculatorResult:: |
public | function | Gets the calculated price. | |
PriceCalculatorResult:: |
public | function | Constructs a new PriceCalculatorResult object. |