in src/FacebookAds/Object/ServerSide/CustomData.php [421:468]
public function normalize() {
$normalized_payload = array();
$normalized_payload['value'] = $this->getValue();
$normalized_payload['currency'] =
Normalizer::normalize('currency', $this->getCurrency());
$normalized_payload['content_name'] = $this->getContentName();
$normalized_payload['content_category'] = $this->getContentCategory();
$normalized_payload['content_ids'] = $this->getContentIds();
$normalized_payload['content_type'] = $this->getContentType();
$normalized_payload['order_id'] = $this->getOrderId();
$normalized_payload['predicted_ltv'] = $this->getPredictedLtv();
$normalized_payload['num_items'] = $this->getNumItems();
$normalized_payload['status'] = $this->getStatus();
$normalized_payload['search_string'] = $this->getSearchString();
$normalized_payload['item_number'] = $this->getItemNumber();
$normalized_payload['delivery_category'] =
Normalizer::normalize('delivery_category', $this->getDeliveryCategory());
if (isset($this->container['contents'])) {
$contents = [];
foreach ($this->getContents() as $content) {
array_push($contents, $content->normalize());
}
$normalized_payload['contents'] = $contents;
}
if (isset($this->container['custom_properties'])) {
foreach ($this->getCustomProperties() as $key => $val) {
if (array_key_exists($key, $normalized_payload)) {
throw new \Exception('Duplicate key defined as part of the custom_properties. key: "' . $key . '". Please make sure the keys defined in the custom_properties are not already available in standard custom_data property list.');
}
$normalized_payload[$key] = $val;
}
}
$normalized_payload = array_filter($normalized_payload, function($val) {
if (is_array($val)) {
return true;
} else {
return strlen($val);
}
});
return $normalized_payload;
}