You are here

protected function Adjustment::assertSameType in Commerce Core 8.2

Asserts that the given adjustment's type matches the current one.

Parameters

\Drupal\commerce_order\Adjustment $adjustment: The adjustment to compare.

Throws

\InvalidArgumentException Thrown when the adjustment type does not match the current one.

2 calls to Adjustment::assertSameType()
Adjustment::add in modules/order/src/Adjustment.php
Adds the given adjustment to the current adjustment.
Adjustment::subtract in modules/order/src/Adjustment.php
Subtracts the given adjustment from the current adjustment.

File

modules/order/src/Adjustment.php, line 298

Class

Adjustment
Represents an adjustment.

Namespace

Drupal\commerce_order

Code

protected function assertSameType(Adjustment $adjustment) {
  if ($this->type != $adjustment
    ->getType()) {
    throw new \InvalidArgumentException(sprintf('Adjustment type "%s" does not match "%s".', $adjustment
      ->getType(), $this->type));
  }
}