You are here

final class Sequence in Commerce Core 8.2

Represents a sequence.

Hierarchy

  • class \Drupal\commerce_number_pattern\Sequence

Expanded class hierarchy of Sequence

4 files declare their use of Sequence
Infinite.php in modules/number_pattern/src/Plugin/Commerce/NumberPattern/Infinite.php
Monthly.php in modules/number_pattern/src/Plugin/Commerce/NumberPattern/Monthly.php
SequentialNumberPatternBase.php in modules/number_pattern/src/Plugin/Commerce/NumberPattern/SequentialNumberPatternBase.php
Yearly.php in modules/number_pattern/src/Plugin/Commerce/NumberPattern/Yearly.php

File

modules/number_pattern/src/Sequence.php, line 8

Namespace

Drupal\commerce_number_pattern
View source
final class Sequence {

  /**
   * The number.
   *
   * @var int
   */
  protected $number;

  /**
   * The generated timestamp.
   *
   * @var int
   */
  protected $generated;

  /**
   * The store ID.
   *
   * @var int
   */
  protected $storeId;

  /**
   * Constructs a new Sequence object.
   *
   * @param array $definition
   *   The definition.
   */
  public function __construct(array $definition) {
    foreach ([
      'number',
      'generated',
    ] as $required_property) {
      if (empty($definition[$required_property])) {
        throw new \InvalidArgumentException(sprintf('Missing required property %s.', $required_property));
      }
    }
    $this->number = $definition['number'];
    $this->generated = $definition['generated'];
    $this->storeId = isset($definition['store_id']) ? $definition['store_id'] : 0;
  }

  /**
   * Gets the number.
   *
   * @return int
   *   The number.
   */
  public function getNumber() : int {
    return $this->number;
  }

  /**
   * Gets the generated timestamp.
   *
   * @return int
   *   The generated timestamp.
   */
  public function getGeneratedTime() : int {
    return $this->generated;
  }

  /**
   * Gets the store ID.
   *
   * @return int
   *   The store ID, or 0 if the sequence is not store specific.
   */
  public function getStoreId() : int {
    return $this->storeId;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Sequence::$generated protected property The generated timestamp.
Sequence::$number protected property The number.
Sequence::$storeId protected property The store ID.
Sequence::getGeneratedTime public function Gets the generated timestamp.
Sequence::getNumber public function Gets the number.
Sequence::getStoreId public function Gets the store ID.
Sequence::__construct public function Constructs a new Sequence object.