add an associative list of contact.

@param contact[=>] list of contact

@return bool
176820
public function addAssocContacts($contacts)
    {
        if (!is_array($contacts)) {
            return false;
        }
        foreach ($contacts as $name => $contact) {
            if (is_object($contact) && $contact  instanceof SoapVar) {
                $contact = $contact->enc_value;
            }
            if (!($contact  instanceof contact)) {
                return false;
            }
            if ($name != $contact->name) {
                return false;
            }
            $this->contacts[] = $contact;
        }

        return true;
    }
602598
def contacts(opts={})
      # NOTE: caching functionality can be dependant of the nature of the list, if dynamic or not ...
      bypass_cache = opts.delete(:bypass_cache) { false }
      recent = opts.delete(:recent) { false }
      paged = opts.delete(:paged) { false }

      if bypass_cache || @contacts.nil?
        path = recent ? RECENT_CONTACTS_PATH : CONTACTS_PATH
        opts[:list_id] = @id

        response = Hubspot::Connection.get_json(path, Hubspot::ContactProperties.add_default_parameters(opts))
        @contacts = response['contacts'].map! { |c| Hubspot::Contact.from_result(c) }
        paged ? response : @contacts
      else
        @contacts
      end
    end
41226
function add_to_group($group_id, $contact_ids)
    {
        $group_cache = $this->_fetch_groups();
        $member_attr = $group_cache[$group_id]['member_attr'];
        $group_dn    = $group_cache[$group_id]['dn'];
        $new_attrs   = array();

        if (!is_array($contact_ids)) {
            $contact_ids = explode(',', $contact_ids);
        }

        foreach ($contact_ids as $id) {
            $new_attrs[$member_attr][] = self::dn_decode($id);
        }

        if (!$this->ldap->mod_add($group_dn, $new_attrs)) {
            $this->set_error(self::ERROR_SAVING, 'errorsaving');
            return 0;
        }

        if ($this->cache) {
            $this->cache->remove('groups');
        }

        return count($new_attrs[$member_attr]);
    }
302504
public function setContactId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->contact_id !== $v) {
            $this->contact_id = $v;
            $this->modifiedColumns[DealerContactInfoTableMap::CONTACT_ID] = true;
        }

        if ($this->aDealerContact !== null && $this->aDealerContact->getId() !== $v) {
            $this->aDealerContact = null;
        }


        return $this;
    }
1253865
public function hasContacts(array $contacts): bool
    {
        foreach ($contacts as $contact) {
            if (!$this->hasContact($contact)) {
                return false;
            }
        }

        return true;
    }
104068
public function addContextContact(Contact $contact = null)
    {
        if (!$contact) {
            return $this;
        }
        $context = [];
        $conType = [];

        // Append contact ID.
        $contactId     = (int) $contact->getId();
        $context['id'] = isset($contactId) ? $contactId : null;
        $conType['id'] = 'number';

        // Append contact owner data.
        $owner                         = $contact->getOwner();
        $context['owner']              = [];
        $context['owner']['id']        = $owner ? $owner->getId() : null;
        $conType['owner']['id']        = 'number';
        $context['owner']['username']  = $owner ? $owner->getUsername() : null;
        $context['owner']['firstName'] = $owner ? $owner->getFirstName() : null;
        $context['owner']['lastName']  = $owner ? $owner->getLastName() : null;
        $context['owner']['email']     = $owner ? $owner->getEmail() : null;

        // Append points value.
        $points            = $contact->getPoints();
        $context['points'] = isset($points) ? $points : null;
        $conType['points'] = 'number';

        // Append IP Addresses.
        $context['ipAddresses'] = [];
        $context['ip']          = null;
        foreach ($contact->getIpAddresses()->toArray() as $ip => $value) {
            $context['ipAddresses'][] = $ip;
            $context['ip']            = $ip;
        }

        // Add Identified date.
        /** @var \DateTime $dateIdentified */
        $dateIdentified            = $contact->getDateIdentified();
        $context['dateIdentified'] = $dateIdentified ? $this->dateFormatHelper->format($dateIdentified) : null;
        $conType['dateIdentified'] = 'datetime';

        // Add Modified date.
        /** @var \DateTime $dateModified */
        $dateModified            = $contact->getDateModified();
        $context['dateModified'] = $dateModified ? $this->dateFormatHelper->format($dateModified) : null;
        $conType['dateModified'] = 'datetime';

        // Add DNC data.
        $context['doNotContacts'] = [];
        $context['doNotContact']  = false;
        if ($contactId && $this->needsDncData) {
            /** @var \Mautic\LeadBundle\Model\DoNotContact $record */
            foreach ($contact->getDoNotContact() as $record) {
                $context['doNotContacts'][$record->getChannel()]           = [
                    'comments' => $record->getComments(),
                    'reason'   => $record->getReason(),
                    'exists'   => true,
                ];
                $conType['doNotContacts'][$record->getChannel()]['exists'] = 'boolean';
                $context['doNotContact']                                   = true;
            }
            $conType['doNotContact'] = 'boolean';
        }

        // Add UTM data.
        $context['utm'] = [
            'campaign'   => null,
            'content'    => null,
            'medium'     => null,
            'query'      => null,
            'referrer'   => null,
            'remoteHost' => null,
            'source'     => null,
            'term'       => null,
            'url'        => null,
            'userAgent'  => null,
        ];
        if ($contactId && $this->needsUtmData) {
            $utmTags            = $this->utmSourceHelper->getSortedUtmTags($contact);
            $context['utmTags'] = [];
            if ($utmTags) {
                foreach ($utmTags as $utmTag) {
                    $tags                 = [
                        'campaign'   => $utmTag->getUtmCampaign(),
                        'content'    => $utmTag->getUtmContent(),
                        'medium'     => $utmTag->getUtmMedium(),
                        'query'      => $utmTag->getQuery(),
                        'referrer'   => $utmTag->getReferer(),
                        'remoteHost' => $utmTag->getRemoteHost(),
                        'source'     => $utmTag->getUtmSource(),
                        'term'       => $utmTag->getUtmTerm(),
                        'url'        => $utmTag->getUrl(),
                        'userAgent'  => $utmTag->getUserAgent(),
                    ];
                    $context['utmTags'][] = $tags;
                    // Override the {{ utm.values }} to be the latest non-empty version of each found.
                    foreach ($tags as $key => $value) {
                        if (!empty($value)) {
                            $context['utm'][$key] = $value;
                        }
                    }
                }
            }
        }

        // Add Device data.
        $context['device'] = [
            'name'        => null,
            'brand'       => null,
            'model'       => null,
            'fingerprint' => null,
            'trackingId'  => null,
            'os'          => [
                'osName'      => null,
                'osShortName' => null,
                'osVersion'   => null,
                'osPlatform'  => null,
            ],
        ];
        if ($contactId && $this->needsDeviceData) {
            /** @var LeadDeviceRepository $deviceRepo */
            $deviceRepo = $this->contactModel->getDeviceRepository();
            $devices    = $deviceRepo->getEntities(
                [
                    'limit'            => 1,
                    'orderBy'          => $deviceRepo->getTableAlias().'.id',
                    'orderByDir'       => 'DESC',
                    'filter'           => [
                        'force' => [
                            [
                                'column' => 'IDENTITY('.$deviceRepo->getTableAlias().'.lead)',
                                'expr'   => 'eq',
                                'value'  => $contactId,
                            ],
                        ],
                    ],
                    'ignore_paginator' => true,
                ]
            );
            if ($devices && $device = reset($devices)) {
                $context['device'] = [
                    'name'        => $device->getDevice(),
                    'brand'       => $device->getDeviceBrand(),
                    'model'       => $device->getDeviceModel(),
                    'fingerprint' => $device->getDeviceFingerprint(),
                    'trackingId'  => $device->getTrackingId(),
                    'os'          => [
                        'osName'      => $device->getDeviceOsName(),
                        'osShortName' => $device->getDeviceOsShortName(),
                        'osVersion'   => $device->getDeviceOsVersion(),
                        'osPlatform'  => $device->getDeviceOsPlatform(),
                    ],
                ];
            }
        }

        $fieldGroups = $contact->getFields();
        if ($fieldGroups) {
            foreach ($fieldGroups as $fgKey => $fieldGroup) {
                foreach ($fieldGroup as $fkey => $field) {
                    $value = isset($field['value']) ? $field['value'] : '';
                    $type  = isset($field['type']) ? $field['type'] : '';
                    if ('' !== $value && in_array($type, ['datetime', 'date', 'time'])) {
                        // Soft support for labels/values as dates/times.
                        @$newValue = $this->dateFormatHelper->format($value);
                        if (null !== $newValue && '' !== $newValue) {
                            $value = $newValue;
                        }
                    }
                    $context[$fkey] = $value;
                    if ($type) {
                        $conType[$fkey] = $type;
                    }
                }
            }
        }

        // Support multiple contacts in the future if needed by uncommenting a bit here.
        // $contacts = !empty($this->context['contacts']) ? $this->context['contacts'] : [];

        // Set the context to this contact.
        $this->sanitizeContext($context);
        $this->context = array_merge($this->context, $context);
        $this->conType = array_merge($this->conType, $conType);

        // Support multiple contacts for future batch processing.
        // $this->context['contacts']                 = $contacts;
        // $this->context['contacts'][$context['id']] = $context;

        return $this;
    }
827803
public function processFaxes($contact, $faxes)
    {
        $get = function($fax) {
            return $fax->getId();
        };

        $delete = function($fax) use ($contact) {
            $contact->removeFax($fax);

            return true;
        };

        $update = function($fax, $matchedEntry) {
            return $this->updateFax($fax, $matchedEntry);
        };

        $add = function($fax) use ($contact) {
            $this->addFax($contact, $fax);

            return true;
        };

        $entities = $contact->getFaxes();

        $result = $this->processSubEntities(
            $entities,
            $faxes,
            $get,
            $add,
            $update,
            $delete
        );

        $this->resetIndexOfSubentites($entities);

        // check main
        $this->setMainFax($contact);

        return $result;
    }
899620
@NonNull
  public SelfT addContactEndPoints(@NonNull Collection<EndPoint> contactPoints) {
    for (EndPoint contactPoint : contactPoints) {
      addContactEndPoint(contactPoint);
    }
    return self;
  }
1350057
public function contactIsEmployeeOfAccount($contact, $account)
    {
        if ($contact->getAccountContacts() && !$contact->getAccountContacts()->isEmpty()) {
            foreach ($contact->getAccountContacts() as $accountContact) {
                if ($accountContact->getAccount()->getId() === $account->getId()) {
                    return true;
                }
            }
        }

        return false;
    }
978115
public function pushLead($contact, $event = [])
    {
        $this->reset();
        $this->getEvent($event);

        if (empty($this->event['config']['contactclient'])) {
            return false;
        }

        /** @var Contact $contactModel */
        $clientModel = $this->getContactClientModel();
        $client      = $clientModel->getEntity($this->event['config']['contactclient']);

        $this->sendContact($client, $contact, false);

        // Returning false will typically cause a retry.
        // If an error occurred and we do not wish to retry we should return true.
        return $this->valid ? $this->valid : !$this->retry;
    }
1359088
public void setContacts(java.util.Collection<ContactData> contacts) {
        if (contacts == null) {
            this.contacts = null;
            return;
        }

        this.contacts = new java.util.ArrayList<ContactData>(contacts);
    }
572319
public function addContactPersonAttributes(string $attr, string $value) : void
    {
        $this->ContactPersonAttributes[$attr] = $value;
    }
795582
def linkify_contactgroups_contacts(self, contacts):
        
        for contactgroup in self:
            mbrs = contactgroup.get_contacts()

            # The new member list, in id
            new_mbrs = []
            for mbr in mbrs:
                mbr = mbr.strip()  # protect with strip at the beginning so don't care about spaces
                if mbr == '':  # void entry, skip this
                    continue
                member = contacts.find_by_name(mbr)
                # Maybe the contact is missing, if so, must be put in unknown_members
                if member is not None:
                    new_mbrs.append(member.uuid)
                else:
                    contactgroup.add_unknown_members(mbr)

            # Make members uniq
            new_mbrs = list(set(new_mbrs))

            # We find the id, we replace the names
            contactgroup.replace_members(new_mbrs)
1003585
public function create($listId, Contact $contact, $action=Contact::ACTION_ADDFORCE)
    {
        $contact->setAction($action);
        $response = $this->_exec($listId, $contact);
        if (!$response->success()) {
            $this->throwError("ContactsListManager:create() failed", $response);
        }

        return $response->getData();
    }
309934
public function addContacts(array $contacts): SecurityTxt
    {
        if (!$this->validContacts($contacts)) {
            throw new Exception('Contacts must be well-formed e-mails and/or URLs.');
        }

        foreach ($contacts as $contact) {
            $this->contacts[$contact] = true;
        }

        return $this;
    }
883021
public function setContacts(array $contacts): SecurityTxt
    {
        if (!$this->validContacts($contacts, true)) {
            throw new Exception('Contacts array must contain well-formed e-mails and/or URLs.');
        }

        $this->contacts = $contacts;

        return $this;
    }
334107
protected function addContactRelation(array $data, $dataKey, $addCallback)
    {
        $contact = null;
        if (array_key_exists($dataKey, $data) && is_array($data[$dataKey]) && array_key_exists('id', $data[$dataKey])) {
            /** @var Contact $contact */
            $contactId = $data[$dataKey]['id'];
            $contact = $this->em->getRepository(static::$contactEntityName)->find($contactId);
            if (!$contact) {
                // TODO: custom exception dependencyNotFound
                throw new \Exception(sprintf("Entity '%s' with id %s not found", static::$contactEntityName, $contactId));
            }
            $addCallback($contact);
        }
        return $contact;
    }