original_string: public function stop() {
          if (is_null($this->running)) {
              throw new xml_writer_exception('xml_writer_not_started');
          }
          if ($this->running === false) {
              throw new xml_writer_exception('xml_writer_already_stopped');
          }
          if ($this->level > 0) { // Cannot stop if not at level 0, remaining open tags
              throw new xml_writer_exception('xml_writer_open_tags_remaining');
          }
          $this->output->stop();
          $this->running = false;
      }
code: public function stop() {
          if (is_null($this->running)) {
              throw new xml_writer_exception('xml_writer_not_started');
          }
          if ($this->running === false) {
              throw new xml_writer_exception('xml_writer_already_stopped');
          }
          if ($this->level > 0) { // Cannot stop if not at level 0, remaining open tags
              throw new xml_writer_exception('xml_writer_open_tags_remaining');
          }
          $this->output->stop();
          $this->running = false;
      }
code_tokens: public function stop ( ) { if ( is_null ( $ this -> running ) ) { throw new xml_writer_exception ( 'xml_writer_not_started' ) ; } if ( $ this -> running === false ) { throw new xml_writer_exception ( 'xml_writer_already_stopped' ) ; } if ( $ this -> level > 0 ) { // Cannot stop if not at level 0, remaining open tags throw new xml_writer_exception ( 'xml_writer_open_tags_remaining' ) ; } $ this -> output -> stop ( ) ; $ this -> running = false ; }
docstring: Finishes the XML writer, not accepting instructions any more, also
  invoking the underlying @xml_output finish method to close/flush everything as needed
docstring_tokens: Finishes the XML writer not accepting instructions any more also invoking the underlying