original_string: public function writeReport(Report $report): void
      {
          $xml = new \DOMDocument('1.0', 'UTF-8');
  
          $root = $xml->createElement('checkstyle');
          $root->setAttribute('version', APP_NAME . '-' . APP_VERSION);
  
          foreach ($report->getFiles() as $file) {
              $xmlFile = $xml->createElement('file');
              $xmlFile->setAttribute('name', $file->getFilename());
  
              foreach ($file->getIssues() as $issue) {
                  $xmlWarning = $xml->createElement('error');
                  $xmlWarning->setAttribute('line', "" . $issue->getLine());
                  $xmlWarning->setAttribute('severity', $issue->getSeverity());
                  $xmlWarning->setAttribute('message', $issue->getMessage());
                  $xmlWarning->setAttribute('source', $issue->getSource());
  
                  if ($issue->getColumn() !== null) {
                      $xmlWarning->setAttribute('column', "" . $issue->getColumn());
                  }
  
                  $xmlFile->appendChild($xmlWarning);
              }
  
              $root->appendChild($xmlFile);
          }
  
          $xml->appendChild($root);
          $xml->formatOutput = true;
  
          $this->output->write($xml->saveXML());
      }
code: public function writeReport(Report $report): void
      {
          $xml = new \DOMDocument('1.0', 'UTF-8');
  
          $root = $xml->createElement('checkstyle');
          $root->setAttribute('version', APP_NAME . '-' . APP_VERSION);
  
          foreach ($report->getFiles() as $file) {
              $xmlFile = $xml->createElement('file');
              $xmlFile->setAttribute('name', $file->getFilename());
  
              foreach ($file->getIssues() as $issue) {
                  $xmlWarning = $xml->createElement('error');
                  $xmlWarning->setAttribute('line', "" . $issue->getLine());
                  $xmlWarning->setAttribute('severity', $issue->getSeverity());
                  $xmlWarning->setAttribute('message', $issue->getMessage());
                  $xmlWarning->setAttribute('source', $issue->getSource());
  
                  if ($issue->getColumn() !== null) {
                      $xmlWarning->setAttribute('column', "" . $issue->getColumn());
                  }
  
                  $xmlFile->appendChild($xmlWarning);
              }
  
              $root->appendChild($xmlFile);
          }
  
          $xml->appendChild($root);
          $xml->formatOutput = true;
  
          $this->output->write($xml->saveXML());
      }
code_tokens: public function writeReport ( Report $ report ) : void { $ xml = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; $ root = $ xml -> createElement ( 'checkstyle' ) ; $ root -> setAttribute ( 'version' , APP_NAME . '-' . APP_VERSION ) ; foreach ( $ report -> getFiles ( ) as $ file ) { $ xmlFile = $ xml -> createElement ( 'file' ) ; $ xmlFile -> setAttribute ( 'name' , $ file -> getFilename ( ) ) ; foreach ( $ file -> getIssues ( ) as $ issue ) { $ xmlWarning = $ xml -> createElement ( 'error' ) ; $ xmlWarning -> setAttribute ( 'line' , "" . $ issue -> getLine ( ) ) ; $ xmlWarning -> setAttribute ( 'severity' , $ issue -> getSeverity ( ) ) ; $ xmlWarning -> setAttribute ( 'message' , $ issue -> getMessage ( ) ) ; $ xmlWarning -> setAttribute ( 'source' , $ issue -> getSource ( ) ) ; if ( $ issue -> getColumn ( ) !== null ) { $ xmlWarning -> setAttribute ( 'column' , "" . $ issue -> getColumn ( ) ) ; } $ xmlFile -> appendChild ( $ xmlWarning ) ; } $ root -> appendChild ( $ xmlFile ) ; } $ xml -> appendChild ( $ root ) ; $ xml -> formatOutput = true ; $ this -> output -> write ( $ xml -> saveXML ( ) ) ; }
docstring: Writes a report in checkstyle XML format.
  
  @param Report $report The report to print.
  @return void
docstring_tokens: Writes a report in checkstyle XML format .