You are here

class PaymentStatusInfo in Payment 7

Payment status information.

Hierarchy

Expanded class hierarchy of PaymentStatusInfo

File

./payment.classes.inc, line 996
The API and related functions for executing and managing payments.

View source
class PaymentStatusInfo extends PaymentCommon {

  /**
   * A US English human-readable plain text description.
   *
   * @var string
   */
  public $description = '';

  /**
   * This status's parent status.
   *
   * @var string
   */
  public $parent = NULL;

  /**
   * The status itself.
   *
   * @var string
   */
  public $status = '';

  /**
   * A US English human-readable plain text title.
   *
   * @var string
   */
  public $title = '';

  /**
   * Get this payment status's ancestors.
   *
   * @return string[]
   *   The machine names of this status's ancestors.
   */
  function ancestors() {
    $ancestors = array(
      $this->parent,
    );
    if ($this->parent) {
      $ancestors = array_merge($ancestors, payment_status_info($this->parent)
        ->ancestors());
    }
    return array_unique($ancestors);
  }

  /**
   * Get this payment status's children.
   *
   * @return string[]
   *   The machine names of this status's children.
   */
  function children() {
    $children = array();
    foreach (payment_statuses_info() as $status_info) {
      if ($status_info->parent == $this->status) {
        $children[] = $status_info->status;
      }
    }
    return $children;
  }

  /**
   * Get this payment status's descendants.
   *
   * @return string[]
   *   The machine names of this status's descendants.
   */
  function descendants() {
    $children = $this
      ->children();
    $descendants = $children;
    foreach ($children as $child) {
      $descendants = array_merge($descendants, payment_status_info($child)
        ->descendants());
    }
    return array_unique($descendants);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PaymentCommon::__construct function 2
PaymentStatusInfo::$description public property A US English human-readable plain text description.
PaymentStatusInfo::$parent public property This status's parent status.
PaymentStatusInfo::$status public property The status itself.
PaymentStatusInfo::$title public property A US English human-readable plain text title.
PaymentStatusInfo::ancestors function Get this payment status's ancestors.
PaymentStatusInfo::children function Get this payment status's children.
PaymentStatusInfo::descendants function Get this payment status's descendants.