protected function extractBasicFields(EventInterface $event, $serialize = true)
    {
        $fields = [
            'transaction' => $event->getTransactionId(),
            'type' => $event->getEventType(),
            'source' => $event->getSourceName(),
            'parent_source' => null,
            'original' => null,
            'changed' => null,
            'created' => new \DateTime($event->getTimestamp())
        ];

        if (method_exists($event, 'getParentSourceName')) {
            $fields['parent_source'] = $event->getParentSourceName();
        }

        if ($event instanceof BaseEvent) {
            $fields['original'] = $serialize ? $this->serialize($event->getOriginal()) : $event->getOriginal();
            $fields['changed'] = $serialize ? $this->serialize($event->getChanged()) : $event->getChanged();
        }

        return $fields;
    }
protected function extractBasicFields(EventInterface $event, $serialize = true)
    {
        $fields = [
            'transaction' => $event->getTransactionId(),
            'type' => $event->getEventType(),
            'source' => $event->getSourceName(),
            'parent_source' => null,
            'original' => null,
            'changed' => null,
            'created' => new \DateTime($event->getTimestamp())
        ];

        if (method_exists($event, 'getParentSourceName')) {
            $fields['parent_source'] = $event->getParentSourceName();
        }

        if ($event instanceof BaseEvent) {
            $fields['original'] = $serialize ? $this->serialize($event->getOriginal()) : $event->getOriginal();
            $fields['changed'] = $serialize ? $this->serialize($event->getChanged()) : $event->getChanged();
        }

        return $fields;
    }
protected function extractBasicFields ( EventInterface $ event , $ serialize = true ) { $ fields = [ 'transaction' => $ event -> getTransactionId ( ) , 'type' => $ event -> getEventType ( ) , 'source' => $ event -> getSourceName ( ) , 'parent_source' => null , 'original' => null , 'changed' => null , 'created' => new \ DateTime ( $ event -> getTimestamp ( ) ) ] ; if ( method_exists ( $ event , 'getParentSourceName' ) ) { $ fields [ 'parent_source' ] = $ event -> getParentSourceName ( ) ; } if ( $ event instanceof BaseEvent ) { $ fields [ 'original' ] = $ serialize ? $ this -> serialize ( $ event -> getOriginal ( ) ) : $ event -> getOriginal ( ) ; $ fields [ 'changed' ] = $ serialize ? $ this -> serialize ( $ event -> getChanged ( ) ) : $ event -> getChanged ( ) ; } return $ fields ; }
Extracts the basic fields from the audit event object.

@param \AuditStash\EventInterface $event The event object from which to extract the fields.
@param bool $serialize Whether to serialize fields that are expected to hold array data.
@return array
Extracts the basic fields from the audit event object .