/** * {@inheritdoc} */ public function jsonSerialize() { return ['object' => KlaviyoApi::getModelType($this->objectType, TRUE), 'start' => $this->start, 'end' => $this->end, 'page_size' => $this->pageSize, 'total' => $this->total, 'page' => $this->page, 'data' => $this->data]; }
/** * Get the model type. * * @param array $configuration * The key, value pair array to use for populating the data model. * @param string $type * If set then we will check out data map and retrieve the model type. * * @return string * The model data type. */ public static function getModelType($configuration = [], $type = '') { if (empty($type) && !empty($configuration['object'])) { $type = $configuration['object']; } if (empty($type) && !empty($configuration)) { throw new MissingModelTypeException('Unable to determine the model type.'); } return KlaviyoApi::getModelType($type); }