You are here

protected function Adjustment::assertSameSourceId in Commerce Core 8.2

Asserts that the given adjustment's source ID matches the current one.

Parameters

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

Throws

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

2 calls to Adjustment::assertSameSourceId()
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 313

Class

Adjustment
Represents an adjustment.

Namespace

Drupal\commerce_order

Code

protected function assertSameSourceId(Adjustment $adjustment) {
  if ($this->sourceId != $adjustment
    ->getSourceId()) {
    throw new \InvalidArgumentException(sprintf('Adjustment source ID "%s" does not match "%s".', $adjustment
      ->getSourceId(), $this->sourceId));
  }
}