private function buildEvents(array $state): array
    {
        $events = [];
        foreach ($this->getOffsetFromArray($state, 'events', []) as $event) {
            $events[] = new Event(
                $this->getOffsetFromArray($event, 'name'),
                $this->getOffsetFromArray($event, 'targetState'),
                $this->getOffsetFromArray($event, 'errorState'),
                $this->getOffsetFromArray($event, 'command'),
                $this->getAdditionalFromArray($event, ['name', 'command', 'targetState', 'errorState'])
            );
        }

        return $events;
    }
private function buildEvents(array $state): array
    {
        $events = [];
        foreach ($this->getOffsetFromArray($state, 'events', []) as $event) {
            $events[] = new Event(
                $this->getOffsetFromArray($event, 'name'),
                $this->getOffsetFromArray($event, 'targetState'),
                $this->getOffsetFromArray($event, 'errorState'),
                $this->getOffsetFromArray($event, 'command'),
                $this->getAdditionalFromArray($event, ['name', 'command', 'targetState', 'errorState'])
            );
        }

        return $events;
    }
private function buildEvents ( array $ state ) : array { $ events = [ ] ; foreach ( $ this -> getOffsetFromArray ( $ state , 'events' , [ ] ) as $ event ) { $ events [ ] = new Event ( $ this -> getOffsetFromArray ( $ event , 'name' ) , $ this -> getOffsetFromArray ( $ event , 'targetState' ) , $ this -> getOffsetFromArray ( $ event , 'errorState' ) , $ this -> getOffsetFromArray ( $ event , 'command' ) , $ this -> getAdditionalFromArray ( $ event , [ 'name' , 'command' , 'targetState' , 'errorState' ] ) ) ; } return $ events ; }
Build state events

@param array $state

@return Event[]
Build state events