You are here

class Time in Lightning Workflow 8.3

Decorates the time service to facilitate testing.

Hierarchy

Expanded class hierarchy of Time

2 string references to 'Time'
lightning_scheduler.services.yml in modules/lightning_scheduler/lightning_scheduler.services.yml
modules/lightning_scheduler/lightning_scheduler.services.yml
ModerationHistoryTest::testModerationHistory in tests/src/Functional/ModerationHistoryTest.php
Tests the moderation_history view for a node with revisions.
1 service uses Time
lightning_scheduler.datetime.time in modules/lightning_scheduler/lightning_scheduler.services.yml
Drupal\lightning_scheduler\Time

File

modules/lightning_scheduler/src/Time.php, line 12

Namespace

Drupal\lightning_scheduler
View source
class Time extends BaseTime {

  /**
   * The state service.
   *
   * @var \Drupal\Core\State\StateInterface
   */
  private $state;

  /**
   * Time constructor.
   *
   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
   *   The request stack.
   * @param \Drupal\Core\State\StateInterface $state
   *   The state service.
   */
  public function __construct(RequestStack $request_stack, StateInterface $state) {
    parent::__construct($request_stack);
    $this->state = $state;
  }

  /**
   * {@inheritdoc}
   */
  public function getRequestTime() {
    return $this->state
      ->get('lightning_scheduler.request_time', parent::getRequestTime());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Time::$requestStack protected property The request stack.
Time::$state private property The state service.
Time::getCurrentMicroTime public function Returns the current system time with microsecond precision. Overrides TimeInterface::getCurrentMicroTime
Time::getCurrentTime public function Returns the current system time as an integer. Overrides TimeInterface::getCurrentTime
Time::getRequestMicroTime public function Returns the timestamp for the current request with microsecond precision. Overrides TimeInterface::getRequestMicroTime
Time::getRequestTime public function Returns the timestamp for the current request. Overrides Time::getRequestTime
Time::__construct public function Time constructor. Overrides Time::__construct