/** * Factory method to create an VerifiedEmail object from an array * @param array $props - associative array of initial properties to set * @return VerifiedEmailAddress */ public static function create(array $props) { $verifiedAddress = new VerifiedEmailAddress(); $verifiedAddress->email_address = parent::getValue($props, "email_address"); $verifiedAddress->status = parent::getValue($props, "status"); return $verifiedAddress; }
/** * Factory method to create a CustomField object from an array * @param array $props - Associative array of initial properties to set * @return CustomField */ public static function create(array $props) { $custom_field = new CustomField(); $custom_field->name = parent::getValue($props, "name"); $custom_field->value = parent::getValue($props, "value"); return $custom_field; }
/** * Factory method to create a Schedule object from an array * @param array $props - associative array of initial properties to set * @return Schedule */ public static function create(array $props) { $schedule = new Schedule(); $schedule->id = parent::getValue($props, "id"); $schedule->scheduled_date = parent::getValue($props, "scheduled_date"); return $schedule; }
/** * Factory method to create an Activity object from an array * @param array $props - associative array of initial properties to set * @return Activity */ public static function create(array $props) { $activity = new Activity(); $activity->id = parent::getValue($props, "id"); $activity->type = parent::getValue($props, "type"); $activity->status = parent::getValue($props, "status"); $activity->start_date = parent::getValue($props, "start_date"); $activity->finish_date = parent::getValue($props, "finish_date"); $activity->created_date = parent::getValue($props, "created_date"); $activity->error_count = parent::getValue($props, "error_count"); $activity->contact_count = parent::getValue($props, "contact_count"); // set any errors that exist, otherwise destroy the property if (array_key_exists('errors', $props)) { foreach ($props['errors'] as $error) { $activity->errors[] = ActivityError::create($error); } } else { unset($activity->errors); } // set any warnings that exist, otherwise destroy the property if (array_key_exists('warnings', $props)) { foreach ($props['warnings'] as $error) { $activity->warnings[] = ActivityError::create($error); } } else { unset($activity->warnings); } // set the file name if exists if (array_key_exists('file_name', $props)) { $activity->file_name = $props['file_name']; } else { unset($activity->file_name); } return $activity; }
public static function create(array $props) { $fileUploadStatus = new FileUploadStatus(); $fileUploadStatus->description = parent::getValue($props, "description"); $fileUploadStatus->file_id = parent::getValue($props, "file_id"); $fileUploadStatus->status = parent::getValue($props, "status"); return $fileUploadStatus; }
/** * Factory method to create a Note object from an array * @param array $props - Associative array of initial properties to set * @return Note */ public static function create(array $props) { $note = new Note(); $note->id = parent::getValue($props, "id"); $note->note = parent::getValue($props, "note"); $note->created_date = parent::getValue($props, "created_date"); return $note; }
/** * Factory method to create an object from an array * @param array $props - associative array of initial properties to set * @return ActivityError */ public static function create(array $props) { $activityError = new ActivityError(); $activityError->message = parent::getValue($props, "message"); $activityError->line_number = parent::getValue($props, "line_number"); $activityError->email_address = parent::getValue($props, "email_address"); return $activityError; }
/** * Factory method to create a ClickThroughDetails object from an array * @param array $props - associative array of initial properties to set * @return ClickThroughDetails */ public static function create(array $props) { $click_through_details = new ClickThroughDetails(); $click_through_details->url = parent::getValue($props, "url"); $click_through_details->url_uid = parent::getValue($props, "url_uid"); $click_through_details->click_count = parent::getValue($props, "click_count"); return $click_through_details; }
public static function create(array $props) { $thumbnail = new Thumbnail(); $thumbnail->url = parent::getValue($props, "url"); $thumbnail->width = parent::getValue($props, "width"); $thumbnail->height = parent::getValue($props, "height"); return $thumbnail; }
/** * Factory method to create a ContactList object from an array * @param array $props - Associative array of initial properties to set * @return ContactList */ public static function create(array $props) { $contact_list = new ContactList(); $contact_list->id = parent::getValue($props, "id"); $contact_list->name = parent::getValue($props, "name"); $contact_list->status = parent::getValue($props, "status"); $contact_list->contact_count = parent::getValue($props, "contact_count"); return $contact_list; }
/** * Factory method to create a OpenActivity object from an array * @param array $props - array of properties to create object from * @return OpenActivity */ public static function create(array $props) { $open_activity = new OpenActivity(); $open_activity->activity_type = parent::getValue($props, "activity_type"); $open_activity->open_date = parent::getValue($props, "open_date"); $open_activity->contact_id = parent::getValue($props, "contact_id"); $open_activity->email_address = parent::getValue($props, "email_address"); $open_activity->campaign_id = parent::getValue($props, "campaign_id"); return $open_activity; }
/** * Factory method to create a TestSend object from an array * @param array $props - associative array of initial properties to set * @return TestSend */ public static function create(array $props) { $test_send = new TestSend(); $test_send->format = parent::getValue($props, "format"); $test_send->personal_message = parent::getValue($props, "personal_message"); foreach ($props['email_addresses'] as $email_address) { $test_send->email_addresses[] = $email_address; } return $test_send; }
/** * Factory method to create a CampaignPreview object from an array * @param array $props - associative array of initial properties to set * @return CampaignPreview */ public static function create(array $props) { $preview = new CampaignPreview(); $preview->fromEmail = parent::getValue($props, "from_email"); $preview->replyToEmail = parent::getValue($props, "reply_to_email"); $preview->htmlContent = parent::getValue($props, "preview_email_content"); $preview->textContent = parent::getValue($props, "preview_text_content"); $preview->subject = parent::getValue($props, "subject"); return $preview; }
/** * Factory method to create a SentActivity object from an array * @param array $props - array of properties to create object from * @return SentActivity */ public static function create(array $props) { $sent_activity = new SendActivity(); $sent_activity->activity_type = parent::getValue($props, "activity_type"); $sent_activity->send_date = parent::getValue($props, "send_date"); $sent_activity->contact_id = parent::getValue($props, "contact_id"); $sent_activity->email_address = parent::getValue($props, "email_address"); $sent_activity->campaign_id = parent::getValue($props, "campaign_id"); return $sent_activity; }
/** * Factory method to create a TrackingSummary object from an array * @param array $props - array of properties to create object from * @return TrackingSummary */ public static function create(array $props) { $tracking_summary = new TrackingSummary(); $tracking_summary->sends = parent::getValue($props, "sends"); $tracking_summary->opens = parent::getValue($props, "opens"); $tracking_summary->clicks = parent::getValue($props, "clicks"); $tracking_summary->forwards = parent::getValue($props, "forwards"); $tracking_summary->unsubscribes = parent::getValue($props, "unsubscribes"); $tracking_summary->bounces = parent::getValue($props, "bounces"); return $tracking_summary; }
/** * Factory method to create a ClickActivity object from an array * @param array $props - array of properties to create object from * @return ClickActivity */ public static function create(array $props) { $click_activity = new ClickActivity(); $click_activity->activity_type = parent::getValue($props, "activity_type"); $click_activity->campaign_id = parent::getValue($props, "campaign_id"); $click_activity->contact_id = parent::getValue($props, "contact_id"); $click_activity->email_address = parent::getValue($props, "email_address"); $click_activity->link_id = parent::getValue($props, "link_id"); $click_activity->click_date = parent::getValue($props, "click_date"); return $click_activity; }
/** * Factory method to create an OptOutActivity object from an array * @param array $props - array of properties to create object from * @return UnsubscribeActivity */ public static function create(array $props) { $opt_out_activity = new UnsubscribeActivity(); $opt_out_activity->activity_type = parent::getValue($props, "activity_type"); $opt_out_activity->unsubscribe_date = parent::getValue($props, "unsubscribe_date"); $opt_out_activity->unsubscribe_source = parent::getValue($props, "unsubscribe_source"); $opt_out_activity->unsubscribe_reason = parent::getValue($props, "unsubscribe_reason"); $opt_out_activity->contact_id = parent::getValue($props, "contact_id"); $opt_out_activity->email_address = parent::getValue($props, "email_address"); $opt_out_activity->campaign_id = parent::getValue($props, "campaign_id"); return $opt_out_activity; }
/** * Factory method to create an EmailAddress object from an array * @param array $props - Associative array of initial properties to set * @return EmailAddress */ public static function create(array $props) { $email_address = new EmailAddress(); $email_address->id = parent::getValue($props, "id"); $email_address->status = parent::getValue($props, "status"); $email_address->confirm_status = parent::getValue($props, "confirm_status"); $email_address->opt_in_source = parent::getValue($props, "opt_in_source"); $email_address->opt_in_date = parent::getValue($props, "opt_in_date"); $email_address->opt_out_date = parent::getValue($props, "opt_out_date"); $email_address->email_address = parent::getValue($props, "email_address"); return $email_address; }
/** * Factory method to create a BounceActivity object from an array * @param array $props - array of properties to create object from * @return BounceActivity */ public static function create(array $props) { $bounceActivity = new BounceActivity(); $bounceActivity->activity_type = parent::getValue($props, "activity_type"); $bounceActivity->bounce_code = parent::getValue($props, "bounce_code"); $bounceActivity->bounce_description = parent::getValue($props, "bounce_description"); $bounceActivity->bounce_message = parent::getValue($props, "bounce_message"); $bounceActivity->bounce_date = parent::getValue($props, "bounce_date"); $bounceActivity->contact_id = parent::getValue($props, "contact_id"); $bounceActivity->email_address = parent::getValue($props, "email_address"); $bounceActivity->campaign_id = parent::getValue($props, "campaign_id"); return $bounceActivity; }
public static function create(array $props) { $folder = new Folder(); $folder->id = parent::getValue($props, "id"); $folder->name = parent::getValue($props, "name"); foreach ($props['children'] as $child) { $folder->children[] = Folder::create($child); } $folder->item_count = parent::getValue($props, "item_count"); $folder->parent_id = parent::getValue($props, "parent_id"); $folder->level = parent::getValue($props, "level"); return $folder; }
/** * Factory method to create an Address object from an array * @array $props - Associative array of initial properties to set * @return Address */ public static function create(array $props) { $address = new Address(); $address->id = parent::getValue($props, "id"); $address->line1 = parent::getValue($props, "line1"); $address->line2 = parent::getValue($props, "line2"); $address->line3 = parent::getValue($props, "line3"); $address->city = parent::getValue($props, "city"); $address->address_type = parent::getValue($props, "address_type"); $address->state_code = parent::getValue($props, "state_code"); $address->country_code = parent::getValue($props, "country_code"); $address->postal_code = parent::getValue($props, "postal_code"); $address->sub_postal_code = parent::getValue($props, "sub_postal_code"); return $address; }
/** * Factory method to create an AccountInfo object from an array * @param array $props - associative array of initial properties to set * @return AccountInfo */ public static function create(array $props) { $accountInfo = new AccountInfo(); $accountInfo->website = parent::getValue($props, "website"); $accountInfo->organization_name = parent::getValue($props, "organization_name"); $accountInfo->time_zone = parent::getValue($props, "time_zone"); $accountInfo->first_name = parent::getValue($props, "first_name"); $accountInfo->last_name = parent::getValue($props, "last_name"); $accountInfo->email_address = parent::getValue($props, "email"); $accountInfo->phone = parent::getValue($props, "phone"); $accountInfo->country_code = parent::getValue($props, "country_code"); $accountInfo->state_code = parent::getValue($props, "state_code"); $accountInfo->organization_addresses = parent::getValue($props, "organization_addresses"); return $accountInfo; }
/** * Factory method to create a TrackingSummary object from an array * @param array $props - array of properties to create object from * @return TrackingSummary */ public static function create(array $props) { $tracking_summary = new TrackingSummary(); $tracking_summary->sends = parent::getValue($props, "sends"); $tracking_summary->opens = parent::getValue($props, "opens"); $tracking_summary->clicks = parent::getValue($props, "clicks"); $tracking_summary->forwards = parent::getValue($props, "forwards"); $tracking_summary->unsubscribes = parent::getValue($props, "unsubscribes"); $tracking_summary->bounces = parent::getValue($props, "bounces"); $tracking_summary->spam_count = parent::getValue($props, "spam_count"); // Contacts don't have spam_count, only Campaigns if (is_null($tracking_summary->spam_count)) { unset($tracking_summary->spam_count); } return $tracking_summary; }
/** * Factory method to create a MessageFooter object from an array * @param array $props - associative array of initial properties to set * @return MessageFooter */ public static function create(array $props) { $message_footer = new MessageFooter(); $message_footer->city = parent::getValue($props, "city"); $message_footer->state = parent::getValue($props, "state"); $message_footer->country = parent::getValue($props, "country"); $message_footer->organization_name = parent::getValue($props, "organization_name"); $message_footer->address_line_1 = parent::getValue($props, "address_line_1"); $message_footer->address_line_2 = parent::getValue($props, "address_line_2"); $message_footer->address_line_3 = parent::getValue($props, "address_line_3"); $message_footer->international_state = parent::getValue($props, "international_state"); $message_footer->postal_code = parent::getValue($props, "postal_code"); $message_footer->include_forward_email = parent::getValue($props, "include_forward_email"); $message_footer->forward_email_link_text = parent::getValue($props, "forward_email_link_text"); $message_footer->include_subscribe_link = parent::getValue($props, "include_subscribe_link"); $message_footer->subscribe_link_text = parent::getValue($props, "subscribe_link_text"); return $message_footer; }
/** * Factory method to create an Activity object from an array * @param array $props - associative array of initial properties to set * @return Campaign */ public function __construct(array $props = array()) { foreach ($this as $property => $value) { $this->{$property} = parent::getValue($props, $property); } }
/** * Factory method to create a Contact object from an array * @param array $props - Associative array of initial properties to set * @return Contact */ public static function create(array $props) { $contact = new Contact(); $contact->id = parent::getValue($props, "id"); $contact->status = parent::getValue($props, "status"); $contact->first_name = parent::getValue($props, "first_name"); $contact->middle_name = parent::getValue($props, "middle_name"); $contact->last_name = parent::getValue($props, "last_name"); $contact->confirmed = parent::getValue($props, "confirmed"); $contact->source = parent::getValue($props, "source"); if (isset($props['email_addresses'])) { foreach ($props['email_addresses'] as $email_address) { $contact->email_addresses[] = EmailAddress::create($email_address); } } $contact->prefix_name = parent::getValue($props, "prefix_name"); $contact->job_title = parent::getValue($props, "job_title"); if (isset($props['addresses'])) { foreach ($props['addresses'] as $address) { $contact->addresses[] = Address::create($address); } } if (isset($props['notes'])) { foreach ($props['notes'] as $note) { $contact->notes[] = Note::create($note); } } $contact->company_name = parent::getValue($props, "company_name"); $contact->home_phone = parent::getValue($props, "home_phone"); $contact->work_phone = parent::getValue($props, "work_phone"); $contact->cell_phone = parent::getValue($props, "cell_phone"); $contact->fax = parent::getValue($props, "fax"); if (isset($props['custom_fields'])) { foreach ($props['custom_fields'] as $custom_field) { $contact->custom_fields[] = CustomField::create($custom_field); } } if (isset($props['lists'])) { foreach ($props['lists'] as $contact_list) { $contact->lists[] = ContactList::create($contact_list); } } $contact->created_date = parent::getValue($props, "created_date"); $contact->modified_date = parent::getValue($props, "modified_date"); $contact->source_details = parent::getValue($props, "source_details"); return $contact; }
/** * Factory method to create a Campaign object from an array * @param array $props - associative array of initial properties to set * @return Campaign */ public static function createSummary(array $props) { $campaign = new Campaign(); $campaign->id = parent::getValue($props, "id"); $campaign->name = parent::getValue($props, "name"); $campaign->status = parent::getValue($props, "status"); $campaign->modified_date = parent::getValue($props, "modified_date"); // remove unused fields foreach ($campaign as $key => $value) { if ($value == null) { unset($campaign->{$key}); } } return $campaign; }
public static function create(array $props) { $file = new File(); $file->id = parent::getValue($props, "id"); $file->name = parent::getValue($props, "name"); $file->description = parent::getValue($props, "description"); $file->folder = parent::getValue($props, "folder"); $file->folder_id = parent::getValue($props, "folder_id"); $file->is_image = parent::getValue($props, "is_image"); $file->type = parent::getValue($props, "file_type"); $file->height = parent::getValue($props, "height"); $file->width = parent::getValue($props, "width"); $file->size = parent::getValue($props, "size"); $file->url = parent::getValue($props, "url"); $file->source = parent::getValue($props, "source"); $file->status = parent::getValue($props, "status"); if (array_key_exists("thumbnail", $props)) { $file->thumbnail = Thumbnail::create($props['thumbnail']); } $file->created_date = parent::getValue($props, "created_date"); $file->modified_date = parent::getValue($props, "modified_date"); $file->file_type = parent::getValue($props, "file_type"); return $file; }