/** * Create a new instance and populate its properties with JSON data * @param array $jsonData * @return \moosend\Models\Campaign */ public static function withJSON(array $jsonData) { $instance = new self(); $instance->ID = $jsonData['ID']; $instance->Name = $jsonData['Name']; $instance->Subject = $jsonData['Subject']; $instance->WebLocation = $jsonData['WebLocation']; $instance->HTMLContent = $jsonData['HTMLContent']; $instance->PlainContent = $jsonData['PlainContent']; $instance->Sender = Sender::withJSON($jsonData['Sender']); $instance->DeliveredOn = $jsonData['DeliveredOn']; $instance->ReplyToEmail = Sender::withJSON($jsonData['ReplyToEmail']); $instance->CreatedOn = $jsonData['CreatedOn']; $instance->UpdatedOn = $jsonData['UpdatedOn']; $instance->ScheduledFor = $jsonData['ScheduledFor']; $instance->Timezone = $jsonData['Timezone']; $instance->FormatType = $jsonData['FormatType']; $instance->ABCampaignData = ABCampaignData::withJSON($jsonData['ABCampaignData']); $instance->MailingList = MailingList::withJSON($jsonData['MailingList']); $instance->ConfirmationTo = $jsonData['ConfirmationTo']; $instance->Status = $jsonData['Status']; if (isset($jsonData['Segment'])) { $instance->Segment = Segment::withJSON($jsonData['Segment']); } $instance->IsTransactional = $jsonData['IsTransactional']; return $instance; }