You are here

public function TransitionSet::toArray in Lightning Scheduler 8

Represents the transition set as a map.

Return value

array The transition set as a flat, sorted map, where the keys are the date and time of the transition, and the values are the targeted workflow state ID.

1 call to TransitionSet::toArray()
TransitionSet::getExpectedState in src/TransitionSet.php
Returns the expected workflow state for a given date and time.

File

src/TransitionSet.php, line 59

Class

TransitionSet
@internal This is an internal part of Lightning Scheduler and may be changed or removed at any time without warning. It should not be used by external code in any way.

Namespace

Drupal\lightning_scheduler

Code

public function toArray() {
  $data = [];
  foreach ($this->dateList as $delta => $item) {
    $key = $item->date
      ->getTimestamp();
    $data[$key] = $this->stateList[$delta]->value;
  }
  ksort($data);
  return $data;
}