/** * Constructs a ProductData object populated from a response object * * @param mixed $response the response object from the cURL call * @return ProductData the resulting ProductData object */ private static function buildProductData($response) { return ProductData::createFromMap(get_object_vars($response)); }
/** * Creates a ProductData instance from an array map. * * @param array $map The array map to use for the instance creation. * @return ProductData instance. */ public static function createFromMap($map) { $images = Image::createFromMapArray($map); $actionPeriod = ActionPeriod::createFromMap($map); $subscription = Subscription::createFromMap($map); $pricingData = PricingData::createFromMap($map); $currID = isset($map['id']) ? $map['id'] : null; $currTitle = isset($map['title']) ? $map['title'] : null; $currDesc = isset($map['description']) ? $map['description'] : null; $currCollectible = isset($map['collectible']) ? $map['collectible'] : null; $data = new ProductData($currID, $subscription, $currTitle, $currDesc, $currCollectible, $pricingData, $actionPeriod, $images); if (isset($map['videoPrequelTime']) && !is_null($map['videoPrequelTime'])) { $data->setVideoPrequelTime($map['videoPrequelTime']); } return $data; }