public function TransitionSet::getExpectedState in Lightning Workflow 8.2
Same name and namespace in other branches
- 8.3 modules/lightning_scheduler/src/TransitionSet.php \Drupal\lightning_scheduler\TransitionSet::getExpectedState()
Returns the expected workflow state for a given date and time.
Parameters
\Drupal\Core\Datetime\DrupalDateTime $at: The date and time.
Return value
string|null The expected workflow state for the given date and time. NULL if no workflow state is targeted.
File
- modules/
lightning_scheduler/ src/ TransitionSet.php, line 99
Class
Namespace
Drupal\lightning_schedulerCode
public function getExpectedState(DrupalDateTime $at) {
$at = $at
->getTimestamp();
$data = $this
->toArray();
$filtered_keys = array_filter(array_keys($data), function ($key) use ($at) {
return $key <= $at;
});
if ($filtered_keys) {
return $data[end($filtered_keys)];
}
return NULL;
}