original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Build state events
  
  @param array $state
  
  @return Event[]
docstring_tokens: Build state events