src/Ipechelon.php
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;
                }
            }
        }
    }
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;
                }
            }
        }
    }
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 ; } } } }
Uses the XML to create incidents

@param string $report_xml
Uses the XML to create incidents