original_string: public static function delete_category($id) {
          $category = core_customfield\category_controller::create($id);
          $handler = $category->get_handler();
          self::validate_context($handler->get_configuration_context());
          if (!$handler->can_configure()) {
              throw new moodle_exception('nopermissionconfigure', 'core_customfield');
          }
          $handler->delete_category($category);
      }
code: public static function delete_category($id) {
          $category = core_customfield\category_controller::create($id);
          $handler = $category->get_handler();
          self::validate_context($handler->get_configuration_context());
          if (!$handler->can_configure()) {
              throw new moodle_exception('nopermissionconfigure', 'core_customfield');
          }
          $handler->delete_category($category);
      }
code_tokens: public static function delete_category ( $ id ) { $ category = core_customfield \ category_controller :: create ( $ id ) ; $ handler = $ category -> get_handler ( ) ; self :: validate_context ( $ handler -> get_configuration_context ( ) ) ; if ( ! $ handler -> can_configure ( ) ) { throw new moodle_exception ( 'nopermissionconfigure' , 'core_customfield' ) ; } $ handler -> delete_category ( $ category ) ; }
docstring: Delete category function
  
  @param int $id
docstring_tokens: Delete category function