protected function TimeMachine::getTime in Preview Link 2.0.x
Same name and namespace in other branches
- 2.x tests/modules/preview_link_test_time/src/TimeMachine.php \Drupal\preview_link_test_time\TimeMachine::getTime()
Get the time from state.
@returns \DateTimeImmutable The date time.
Throws
\LogicException When date time was not set.
File
- tests/
modules/ preview_link_test_time/ src/ TimeMachine.php, line 82
Class
- TimeMachine
- Service used to simulate time.
Namespace
Drupal\preview_link_test_timeCode
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;
}