original_string: public static function create_from_question_category_instance($category, $context = null) {
  
          $params = ['objectid' => $category->id];
  
          if (!empty($category->contextid)) {
              $params['contextid'] = $category->contextid;
          }
  
          $params['context'] = $context;
  
          $event = self::create($params);
          return $event;
      }
code: public static function create_from_question_category_instance($category, $context = null) {
  
          $params = ['objectid' => $category->id];
  
          if (!empty($category->contextid)) {
              $params['contextid'] = $category->contextid;
          }
  
          $params['context'] = $context;
  
          $event = self::create($params);
          return $event;
      }
code_tokens: public static function create_from_question_category_instance ( $ category , $ context = null ) { $ params = [ 'objectid' => $ category -> id ] ; if ( ! empty ( $ category -> contextid ) ) { $ params [ 'contextid' ] = $ category -> contextid ; } $ params [ 'context' ] = $ context ; $ event = self :: create ( $ params ) ; return $ event ; }
docstring: Create a event from question category object
  
  @param object $category
  @param object|null $context
  @return base
  @throws \coding_exception
docstring_tokens: Create a event from question category object