Searches for contact in specified data and calls callback function.

@param array $data
@param string $dataKey
@param string $addCallback

@throws \Exception

@return null|Contact
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;
    }
655804
public function call(string $event, $data = null)
    {
        if (!$this->eventExists($event)) {
            return;
        }

        // inject request param on connect event
        $isConnect = $event === static::EVENT_CONNECT;
        $dataKey   = $isConnect ? 'request' : 'data';

        return $this->app->invoke($this->callbacks[$event], [
            'websocket' => $this,
            $dataKey    => $data,
        ]);
    }
905397
public function updateContactDatafieldsByEmail($email, $dataFields)
    {
        $apiContact = $this->postContacts($email);
        //do not create for non contact id set
        if (!isset($apiContact->id)) {
            return $apiContact;
        } else {
            //get the contact id for this email
            $contactId = $apiContact->id;
        }
        $data = [
            'Email' => $email,
            'EmailType' => 'Html',
        ];
        $data['DataFields'] = $dataFields;
        $url = $this->getApiEndpoint() . self::REST_CONTACTS
            . $contactId;
        $this->setUrl($url)
            ->setVerb('PUT')
            ->buildPostBody($data);

        $response = $this->execute();
        if (isset($response->message)) {
            $message = 'ERROR: UPDATE CONTACT DATAFIELD ' . $url . ' message : '
                . $response->message;
            $this->helper->debug('updateContactDatafieldsByEmail', [$message]);
            $this->helper->debug('updateContactDatafieldsByEmail', $data);
        }

        return $response;
    }
165802
public function addBefore($key, callable $callback)
    {
        if ($this->addItem($key, $callback)) {
            return $this;
        }

        throw new \Exception(htmlspecialchars("The item $key was not found."));
    }
515968
public function updateContact($contactId, $data)
    {
        $url = $this->getApiEndpoint() . self::REST_CONTACTS . $contactId;
        $this->setUrl($url)
            ->setVerb('PUT')
            ->buildPostBody($data);

        $response = $this->execute();
        if (isset($response->message)) {
            $message = 'ERROR : UPDATE SINGLE CONTACT : ' . $url . ' message : '
                . $response->message;
            $this->helper->debug('updateContact', [$message]);
            $this->helper->debug('updateContact', $data);
        }

        return $response;
    }
101070
public function updateContactField($contactFieldId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PATCH', sprintf('contact_fields/%d', $contactFieldId), [], $data)
		);
	}
323789
function(data, callback) {
    var json
    try {
        json = JSON.parse(data)
    } catch (exc) {
        return callback(exc)
    }
    callback(null, json)
}
713426
public function replaceContact($contactId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PUT', sprintf('contacts/%d', $contactId), [], $data)
		);
	}
48133
public function setCallback($callback = null)
    {
        if (!is_null($callback) && !is_callable($callback)) {
            throw new Exception("callback must be of type callable or null");
        }

        $this->callback = $callback;

        return $this;
    }
182464
public function send($view, array $data, Closure $callback, $message = null)
    {
        $this->message = $message ?: new Message($this->mailgun->MessageBuilder(), $this->config);

        $this->callMessageBuilder($callback, $this->message);
        $this->renderBody($view, $data);

        $message = $this->message->getMessage();
        $files = $this->message->getFiles();

        $domain = $this->config->get('mailgun.domain');
        $response = new Response($this->mailgun->post("{$domain}/messages", $message, $files));

        return $response;
    }
1150726
private function addingAttribute(\stdClass $obj, array $elements, int $dataKey)
    {
        foreach ($elements as $name => $value) {
            try {
                $obj->$name = is_callable($value) ? $value($this->rawData[$dataKey]) : $value;
            } catch (\Exception $ex) {
                throw new \Exception("Could not process attribute {$name}");
            }
        }
        return $obj;
    }
876725
protected function setDate($data, $key, DateTIme $currentDate, callable $setCallback)
    {
        $date = $this->getProperty($data, $key, $currentDate);
        if ($date !== null) {
            if (is_string($date)) {
                $date = new DateTime($data[$key]);
            }
            call_user_func($setCallback, $date);
        }
    }
331301
protected function addEventListener($name, $callback)
    {
        if (Str::contains($name, '*')) {
            $callback = function ($name, array $data) use ($callback) {
                return $callback($data[0]);
            };
        }

        $this->events->listen($name, $callback);
    }
210475
public function addActionCallback($key, $name, $callback = null)
	{
		$this->addActionCheck($key);

		$params = ['__id' => $this->primary_key];

		$this->actions[$key] = $action = new Column\ActionCallback($this, $key, $name, $params);

		if ($callback) {
			if (!is_callable($callback)) {
				throw new DataGridException('ActionCallback callback has to be callable.');
			}

			$action->onClick[] = $callback;
		}

		return $action;
	}
442874
private static function _checkCallback($cls, $callback, $context)
    {
        self::_initiateCallbacks($cls);
        foreach (self::$_callbacks[$cls][$callback] as $func) {
            if (!call_user_func(array($context, $func))) {
                return false;
            }
        }
        return true;
    }
841803
public function addDataAuthorizationCheck($attributes, $dataKey = null, \Closure $callback = null)
    {
        if (null === $dataKey) {
            $dataKey = 'item';
        }

        $this->security->addDataCheck($attributes, $dataKey, $callback);

        return $this;
    }
1263130
public function find(callable $callback, $keepKey = false, $offset = null, $limit = null)
    {
        return $this->bindNewInstance(Arr::find($this->convertArray($this), $callback, $keepKey, $offset, $limit));
    }