You are here

class InvoiceNumber in Commerce Invoice 7.2

Hierarchy

Expanded class hierarchy of InvoiceNumber

3 files declare their use of InvoiceNumber
commerce_invoice.module in ./commerce_invoice.module
The Commerce Invoice module.
commerce_invoice.theme.inc in ./commerce_invoice.theme.inc
Theme functions for the Commerce Invoice module.
Invoice.php in src/Entity/Invoice.php
Invoice entity.

File

src/InvoiceNumber/InvoiceNumber.php, line 9
Invoice Number

Namespace

Drupal\commerce_invoice\InvoiceNumber
View source
class InvoiceNumber {
  const SEQUENCE_TOKEN = '{SEQUENCE}';
  protected $sequence;
  protected $key;
  protected $patternName;

  /**
   * Constructor.
   *
   * @param int    $sequence
   * @param string $key
   * @param string $patternName
   */
  public function __construct($sequence, $key, $patternName) {
    $this->sequence = $sequence;
    $this->key = $key;
    $this->patternName = $patternName;
    $this->pattern = commerce_invoice_number_pattern_load($patternName);
  }

  /**
   * @return int
   */
  public function getSequence() {
    return $this->sequence;
  }

  /**
   * @return string
   */
  public function getKey() {
    return $this->key;
  }

  /**
   * @return string
   */
  public function getPatternName() {
    return $this->patternName;
  }

  /**
   * Magic method to convert the invoice number to a string.
   *
   * @see theme_commerce_invoice_number()
   *
   * @return string
   */
  public function __toString() {
    return theme('commerce_invoice_number', [
      'invoice_number' => $this,
      'sanitize' => FALSE,
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InvoiceNumber::$key protected property
InvoiceNumber::$patternName protected property
InvoiceNumber::$sequence protected property
InvoiceNumber::getKey public function
InvoiceNumber::getPatternName public function
InvoiceNumber::getSequence public function
InvoiceNumber::SEQUENCE_TOKEN constant
InvoiceNumber::__construct public function Constructor.
InvoiceNumber::__toString public function Magic method to convert the invoice number to a string.