You are here

protected function TimeMachine::getTime in Preview Link 8

Get the time from state.

@returns \DateTimeImmutable The date time.

Throws

\LogicException When date time was not set.

File

tests/modules/preview_link_test/src/TimeMachine.php, line 80

Class

TimeMachine
Service used to simulate time.

Namespace

Drupal\preview_link_test

Code

protected function getTime() {
  $dateTime = $this->state
    ->get('preview_link_test_time_machine');
  if (!isset($dateTime)) {
    throw new \LogicException('Current date time not set.');
  }
  return $dateTime;
}