original_string: private function saveIncident($report_xml)
      {
          if (!empty($report_xml) && $report_xml = simplexml_load_string($report_xml)) {
              $this->feedName = 'default';
  
              // If feed is known and enabled, validate data and save report
              if ($this->isKnownFeed() && $this->isEnabledFeed()) {
                  // Create a corrected array
                  $report_raw = json_decode(json_encode($report_xml), true);
                  // Sanity check
                  $report = $this->applyFilters($report_raw['Source']);
                  if ($this->hasRequiredFields($report) === true) {
                      // incident has all requirements met, add!
                      $incident = new Incident();
                      $incident->source      = config("{$this->configBase}.parser.name");
                      $incident->source_id   = false;
                      $incident->ip          = $report['IP_Address'];
                      $incident->domain      = false;
                      $incident->class       = config("{$this->configBase}.feeds.{$this->feedName}.class");
                      $incident->type        = config("{$this->configBase}.feeds.{$this->feedName}.type");
                      $incident->timestamp   = strtotime($report['TimeStamp']);
                      $incident->information = json_encode($report_raw);
  
                      $this->incidents[] = $incident;
                  }
              }
          }
      }
code: private function saveIncident($report_xml)
      {
          if (!empty($report_xml) && $report_xml = simplexml_load_string($report_xml)) {
              $this->feedName = 'default';
  
              // If feed is known and enabled, validate data and save report
              if ($this->isKnownFeed() && $this->isEnabledFeed()) {
                  // Create a corrected array
                  $report_raw = json_decode(json_encode($report_xml), true);
                  // Sanity check
                  $report = $this->applyFilters($report_raw['Source']);
                  if ($this->hasRequiredFields($report) === true) {
                      // incident has all requirements met, add!
                      $incident = new Incident();
                      $incident->source      = config("{$this->configBase}.parser.name");
                      $incident->source_id   = false;
                      $incident->ip          = $report['IP_Address'];
                      $incident->domain      = false;
                      $incident->class       = config("{$this->configBase}.feeds.{$this->feedName}.class");
                      $incident->type        = config("{$this->configBase}.feeds.{$this->feedName}.type");
                      $incident->timestamp   = strtotime($report['TimeStamp']);
                      $incident->information = json_encode($report_raw);
  
                      $this->incidents[] = $incident;
                  }
              }
          }
      }
code_tokens: private function saveIncident ( $ report_xml ) { if ( ! empty ( $ report_xml ) && $ report_xml = simplexml_load_string ( $ report_xml ) ) { $ this -> feedName = 'default' ; // If feed is known and enabled, validate data and save report if ( $ this -> isKnownFeed ( ) && $ this -> isEnabledFeed ( ) ) { // Create a corrected array $ report_raw = json_decode ( json_encode ( $ report_xml ) , true ) ; // Sanity check $ report = $ this -> applyFilters ( $ report_raw [ 'Source' ] ) ; if ( $ this -> hasRequiredFields ( $ report ) === true ) { // incident has all requirements met, add! $ incident = new Incident ( ) ; $ incident -> source = config ( "{$this->configBase}.parser.name" ) ; $ incident -> source_id = false ; $ incident -> ip = $ report [ 'IP_Address' ] ; $ incident -> domain = false ; $ incident -> class = config ( "{$this->configBase}.feeds.{$this->feedName}.class" ) ; $ incident -> type = config ( "{$this->configBase}.feeds.{$this->feedName}.type" ) ; $ incident -> timestamp = strtotime ( $ report [ 'TimeStamp' ] ) ; $ incident -> information = json_encode ( $ report_raw ) ; $ this -> incidents [ ] = $ incident ; } } } }
docstring: Uses the XML to create incidents
  
  @param string $report_xml
docstring_tokens: Uses the XML to create incidents