original_string: protected static function set_custom_types(array $types) {
          global $CFG;
          // Check the setting hasn't been forced.
          if (array_key_exists('customfiletypes', $CFG->config_php_settings)) {
              throw new coding_exception('Cannot set custom filetypes because they ' .
                      'are defined in config.php');
          }
          if (empty($types)) {
              unset_config('customfiletypes');
          } else {
              set_config('customfiletypes', json_encode(array_values($types)));
          }
  
          // Clear the cached type list.
          self::reset_caches();
      }
code: protected static function set_custom_types(array $types) {
          global $CFG;
          // Check the setting hasn't been forced.
          if (array_key_exists('customfiletypes', $CFG->config_php_settings)) {
              throw new coding_exception('Cannot set custom filetypes because they ' .
                      'are defined in config.php');
          }
          if (empty($types)) {
              unset_config('customfiletypes');
          } else {
              set_config('customfiletypes', json_encode(array_values($types)));
          }
  
          // Clear the cached type list.
          self::reset_caches();
      }
code_tokens: protected static function set_custom_types ( array $ types ) { global $ CFG ; // Check the setting hasn't been forced. if ( array_key_exists ( 'customfiletypes' , $ CFG -> config_php_settings ) ) { throw new coding_exception ( 'Cannot set custom filetypes because they ' . 'are defined in config.php' ) ; } if ( empty ( $ types ) ) { unset_config ( 'customfiletypes' ) ; } else { set_config ( 'customfiletypes' , json_encode ( array_values ( $ types ) ) ) ; } // Clear the cached type list. self :: reset_caches ( ) ; }
docstring: Sets the custom types into config variable, encoding into JSON.
  
  @param array $types Array of custom types
  @throws coding_exception If the custom types are fixed in config.php.
docstring_tokens: Sets the custom types into config variable encoding into JSON .