original_string: public static function delete_tool_type($id) {
          $params = self::validate_parameters(self::delete_tool_type_parameters(),
                                              array(
                                                  'id' => $id,
                                              ));
          $id = $params['id'];
  
          $context = context_system::instance();
          self::validate_context($context);
          require_capability('moodle/site:config', $context);
  
          $type = lti_get_type($id);
  
          if (!empty($type)) {
              lti_delete_type($id);
  
              // If this is the last type for this proxy then remove the proxy
              // as well so that it isn't orphaned.
              $types = lti_get_lti_types_from_proxy_id($type->toolproxyid);
              if (empty($types)) {
                  lti_delete_tool_proxy($type->toolproxyid);
              }
          }
  
          return array('id' => $id);
      }
code: public static function delete_tool_type($id) {
          $params = self::validate_parameters(self::delete_tool_type_parameters(),
                                              array(
                                                  'id' => $id,
                                              ));
          $id = $params['id'];
  
          $context = context_system::instance();
          self::validate_context($context);
          require_capability('moodle/site:config', $context);
  
          $type = lti_get_type($id);
  
          if (!empty($type)) {
              lti_delete_type($id);
  
              // If this is the last type for this proxy then remove the proxy
              // as well so that it isn't orphaned.
              $types = lti_get_lti_types_from_proxy_id($type->toolproxyid);
              if (empty($types)) {
                  lti_delete_tool_proxy($type->toolproxyid);
              }
          }
  
          return array('id' => $id);
      }
code_tokens: public static function delete_tool_type ( $ id ) { $ params = self :: validate_parameters ( self :: delete_tool_type_parameters ( ) , array ( 'id' => $ id , ) ) ; $ id = $ params [ 'id' ] ; $ context = context_system :: instance ( ) ; self :: validate_context ( $ context ) ; require_capability ( 'moodle/site:config' , $ context ) ; $ type = lti_get_type ( $ id ) ; if ( ! empty ( $ type ) ) { lti_delete_type ( $ id ) ; // If this is the last type for this proxy then remove the proxy // as well so that it isn't orphaned. $ types = lti_get_lti_types_from_proxy_id ( $ type -> toolproxyid ) ; if ( empty ( $ types ) ) { lti_delete_tool_proxy ( $ type -> toolproxyid ) ; } } return array ( 'id' => $ id ) ; }
docstring: Delete a tool type.
  
  @param int $id The id of the tool type to be deleted
  @return array deleted tool type
  @since Moodle 3.1
  @throws moodle_exception
docstring_tokens: Delete a tool type .