original_string: public static function revert_type_to_default($extension) {
          $extension = (string)$extension;
  
          // Check it actually is a default type.
          $defaults = self::get_default_types();
          if (!array_key_exists($extension, $defaults)) {
              throw new coding_exception('Extension ' . $extension . ' is not a default type');
          }
  
          // Loop through all the custom settings.
          $changed = false;
          $customs = self::get_custom_types();
          foreach ($customs as $key => $customentry) {
              if ($customentry->extension === $extension) {
                  unset($customs[$key]);
                  $changed = true;
              }
          }
  
          // Save changes if any.
          if ($changed) {
              self::set_custom_types($customs);
          }
          return $changed;
      }
code: public static function revert_type_to_default($extension) {
          $extension = (string)$extension;
  
          // Check it actually is a default type.
          $defaults = self::get_default_types();
          if (!array_key_exists($extension, $defaults)) {
              throw new coding_exception('Extension ' . $extension . ' is not a default type');
          }
  
          // Loop through all the custom settings.
          $changed = false;
          $customs = self::get_custom_types();
          foreach ($customs as $key => $customentry) {
              if ($customentry->extension === $extension) {
                  unset($customs[$key]);
                  $changed = true;
              }
          }
  
          // Save changes if any.
          if ($changed) {
              self::set_custom_types($customs);
          }
          return $changed;
      }
code_tokens: public static function revert_type_to_default ( $ extension ) { $ extension = ( string ) $ extension ; // Check it actually is a default type. $ defaults = self :: get_default_types ( ) ; if ( ! array_key_exists ( $ extension , $ defaults ) ) { throw new coding_exception ( 'Extension ' . $ extension . ' is not a default type' ) ; } // Loop through all the custom settings. $ changed = false ; $ customs = self :: get_custom_types ( ) ; foreach ( $ customs as $ key => $ customentry ) { if ( $ customentry -> extension === $ extension ) { unset ( $ customs [ $ key ] ) ; $ changed = true ; } } // Save changes if any. if ( $ changed ) { self :: set_custom_types ( $ customs ) ; } return $ changed ; }
docstring: Reverts a file type to the default. May only be called on types that have
  default values. This will undelete the type if necessary or set its values.
  If the type is already at default values, does nothing.
  
  @param string $extension File extension without dot, e.g. 'doc'
  @return bool True if anything was changed, false if it was already default
  @throws coding_exception If the extension is not a default type.
docstring_tokens: Reverts a file type to the default . May only be called on types that have default values . This will undelete the type if necessary or set its values . If the type is already at default values does nothing .