Elgg\Notifications\Event::toObject PHP Method

toObject() public method

Export the notification event into a serializable object This method is mainly used for logging purposes
public toObject ( ) : stdClas\stdClass
return stdClas\stdClass
    public function toObject()
    {
        $obj = new stdClass();
        $vars = get_object_vars($this);
        foreach ($vars as $key => $value) {
            if (is_object($value) && is_callable([$value, 'toObject'])) {
                $obj->{$key} = $value->toObject();
            } else {
                $obj->{$key} = $value;
            }
        }
        return $obj;
    }