original_string: protected function flush() {
          global $DB;
  
          // Flush the buffer to the db.
          $events = $this->buffer;
          $DB->insert_records('tool_monitor_events', $events); // Insert the whole chunk into the database.
          $this->buffer = array();
          $this->count = 0;
          return $events;
      }
code: protected function flush() {
          global $DB;
  
          // Flush the buffer to the db.
          $events = $this->buffer;
          $DB->insert_records('tool_monitor_events', $events); // Insert the whole chunk into the database.
          $this->buffer = array();
          $this->count = 0;
          return $events;
      }
code_tokens: protected function flush ( ) { global $ DB ; // Flush the buffer to the db. $ events = $ this -> buffer ; $ DB -> insert_records ( 'tool_monitor_events' , $ events ) ; // Insert the whole chunk into the database. $ this -> buffer = array ( ) ; $ this -> count = 0 ; return $ events ; }
docstring: Protected method that flushes the buffer of events and writes them to the database.
  
  @return array a copy of the events buffer.
docstring_tokens: Protected method that flushes the buffer of events and writes them to the database .