original_string: public static function create_from_question_instance($question, $context = null, $other = null) {
  
          $params = ['objectid' => $question->id, 'other' => ['categoryid' => $question->category]];
  
          if (!empty($question->contextid)) {
              $params['contextid'] = $question->contextid;
          }
  
          $params['context'] = $context;
  
          if (!empty($other)) {
              $params['other'] = $other;
          }
  
          $event = self::create($params);
          return $event;
      }
code: public static function create_from_question_instance($question, $context = null, $other = null) {
  
          $params = ['objectid' => $question->id, 'other' => ['categoryid' => $question->category]];
  
          if (!empty($question->contextid)) {
              $params['contextid'] = $question->contextid;
          }
  
          $params['context'] = $context;
  
          if (!empty($other)) {
              $params['other'] = $other;
          }
  
          $event = self::create($params);
          return $event;
      }
code_tokens: public static function create_from_question_instance ( $ question , $ context = null , $ other = null ) { $ params = [ 'objectid' => $ question -> id , 'other' => [ 'categoryid' => $ question -> category ] ] ; if ( ! empty ( $ question -> contextid ) ) { $ params [ 'contextid' ] = $ question -> contextid ; } $ params [ 'context' ] = $ context ; if ( ! empty ( $ other ) ) { $ params [ 'other' ] = $ other ; } $ event = self :: create ( $ params ) ; return $ event ; }
docstring: Create a event from question object
  
  @param object $question
  @param object|null $context
  @param array|null $other will override the categoryid pre-filled out on the first line.
  @return base
  @throws \coding_exception
docstring_tokens: Create a event from question object