You are here

public function MollieApiMock::__get in Commerce Mollie 8

Magic method that passes every _get to the parent object.

Parameters

string $name: The property to be called.

Return value

$this|string Return the parameter

File

tests/modules/commerce_mollie_tests/src/Services/MollieApiMock.php, line 62

Class

MollieApiMock
Mock class.

Namespace

Drupal\commerce_mollie_tests\Services

Code

public function __get($name) {

  // Overrides the 'id' parameter.
  if ($name === 'id') {
    return 'test_id';
  }

  // Overrides the 'status' parameter.
  if ($name === 'status') {
    if ($this
      ->isPaid()) {
      return MolliePaymentStatus::STATUS_PAID;
    }
    if ($this
      ->isCancelled()) {
      return MolliePaymentStatus::STATUS_CANCELED;
    }
    if ($this
      ->isOpen()) {
      return MolliePaymentStatus::STATUS_OPEN;
    }
    if ($this
      ->isFailed()) {
      return MolliePaymentStatus::STATUS_FAILED;
    }
    if ($this
      ->isExpired()) {
      return MolliePaymentStatus::STATUS_EXPIRED;
    }
    return 'UNDEFINED';
  }

  // Pass any other __get to the parent object.
  return $this;
}