private static function addCustomData()

in Helper/ServerEventFactory.php [106:155]


    private static function addCustomData($event, $data)
    {
        $custom_data = $event->getCustomData();

        if (!empty($data['currency'])) {
            $custom_data->setCurrency($data['currency']);
        }

        if (!empty($data['value'])) {
            $custom_data->setValue($data['value']);
        }

        if (!empty($data['content_ids'])) {
            $custom_data->setContentIds($data['content_ids']);
        }

        if (!empty($data['content_type'])) {
            $custom_data->setContentType($data['content_type']);
        }

        if (!empty($data['content_name'])) {
            $custom_data->setContentName($data['content_name']);
        }

        if (!empty($data['content_category'])) {
            $custom_data->setContentCategory($data['content_category']);
        }

        if (!empty($data['search_string'])) {
            $custom_data->setSearchString($data['search_string']);
        }

        if (!empty($data['num_items'])) {
            $custom_data->setNumItems($data['num_items']);
        }

        if (!empty($data['contents'])) {
            $contents = [];
            foreach ($data['contents'] as $content) {
                $contents[] = new Content($content);
            }
            $custom_data->setContents($contents);
        }

        if (!empty($data['order_id'])) {
            $custom_data->setOrderId($data['order_id']);
        }

        return $event;
    }