@param string $recipientOrPhone
@param string $typingIndicator

@return array
6051
public static function createForTyping($recipientOrPhone, $typingIndicator) {
        $options = [];
        $data = [
            'recipient'     => self::createRecipientField($recipientOrPhone),
            'sender_action' => $typingIndicator,
        ];
        $options[RequestOptions::JSON] = $data;

        return $options;
    }
904831
public function sendMulti($reciversMessage, $date = '', $senderID = '')
    {
        //Pre-checks act1
        if ($senderID == null || !strlen(trim($senderID))) {
            $senderID = $this->config['default_sender'];
        }

        //Sending for future date
        $dateStr = '';
        if (strlen($date)) {
            $dateStr = ' tarih="' . $date . '"';
        }

        $xml = '<?xml version="1.0" encoding="UTF-8"?>' . '<smspack ka="' . $this->config['auth']['username'] . '" pwd="' . $this->config['auth']['password'] . '"' . $dateStr . ' org="' . $senderID . '" charset="' . $this->config['charset'] . '"' . ($this->config['append_unsubscribe_link'] ? ' addLinkToEnd="true"' : '') . '>';

        foreach ($reciversMessage as $eachMessageBlock) {
            $number = $eachMessageBlock[0];
            $message = $eachMessageBlock[1];

            $xml .= '<mesaj>' . '<metin>' . $message . '</metin>' . '<nums>' . $number . '</nums>' . '</mesaj>';
        }

        $xml .= '</smspack>';

        return $this->postXML($xml, 'https://smsgw.mutlucell.com/smsgw-ws/sndblkex');
    }
822341
public function distinctUntilKeyChanged(callable $keySelector = null, callable $comparer = null): Observable
    {
        return $this->lift(function () use ($keySelector, $comparer) {
            return new DistinctUntilChangedOperator($keySelector, $comparer);
        });
    }
884397
public function getMailParameters(NotificationEntity $notification, UserInfo $recipient)
    {
        $notificationData = $notification->getNotificationData();
        $uir = $this->app->make(UserInfoRepository::class);
        $requestedBy = $notificationData['requestedBy'] ? $uir->getByID($notificationData['requestedBy']) : null;
        $deniedBy = $notificationData['by'] ? $uir->getByID($notificationData['by']) : null;

        return [
            'localeName' => Language::getName($notificationData['localeID']),
            'requestedBy' => $requestedBy,
            'deniedBy' => $deniedBy,
            'teamsUrl' => $this->getBlockPageURL('CommunityTranslation Team List'),
        ] + $this->getCommonMailParameters($notification, $recipient);
    }
1260938
public function createSms($body, $recipients, $sender)
    {
        if (is_array($recipients)) {
            $sms = $this->factory->createSms($body, $recipients, $sender);
        } else {
            $sms = $this->factory->createSms($body, array($recipients), $sender);
        }

        return $sms;
    }
68291
public function findUndeliveredRecipientNotification(IdentifierRecipientInterface $recipient)
    {
        $builder = $this->createQueryBuilder('notification');

        $this->addRecipientConditions($builder, $recipient);

        $builder->andWhere($builder->expr()->isNull('notification.deliveredAt'));

        return $builder->getQuery()->getResult();
    }
1163178
private function extractTypeValues(array $columnList, array $types)
    {
        $typeValues = [];

        foreach ($columnList as $columnIndex => $columnName) {
            $typeValues[] = $types[$columnName] ?? ParameterType::STRING;
        }

        return $typeValues;
    }
1234415
public function getRecipientsFromPost(array $referenced_entity) {
    $recipients = [];

    $post = Post::load($referenced_entity['target_id']);
    $recipient_user = $post->get('field_recipient_user')->getValue();
    if (!empty($recipient_user)) {
      $recipients[] = [
        'target_type' => 'user',
        'target_id' => $recipient_user['0']['target_id'],
      ];
    }

    return $recipients;
  }
742956
public function sendNotificationsFor($recipientId, $wrapperTemplateName, $params)
    {
        // get the recipient
        $recipient = $this->recipientProvider->getRecipient($recipientId);

        // get all Notification-Items for the recipient from the database
        $notifications = $this->getNotificationsFor($recipient);
        if (0 == sizeof($notifications)) {
            return null;
        }

        // get the recipient specific parameters for the twig-templates
        $recipientParams = $this->getRecipientVarsForNotificationsEmail($recipient);
        $params = array_merge($recipientParams, $params);

        // prepare the arrays with template and template-variables for each notification
        $contentItems = array();
        foreach ($notifications as $notification) {
            // decode the $params from the json in the notification-entity
            $itemVars = $notification->getVariables();
            $itemVars = array_merge($params, $itemVars);
            $itemVars['notification'] = $notification;
            $itemVars['recipient'] = $recipient;

            $itemTemplateName = $notification->getTemplate();

            $contentItems[] = array($itemTemplateName => $itemVars);
        }

        // add the notifications to the params array so they will be rendered later
        $params[self::CONTENT_ITEMS] = $contentItems;
        $params['recipient'] = $recipient;
        $params['_locale'] = $recipient->getPreferredLocale();

        $subject = $this->getRecipientSpecificNotificationsSubject($contentItems, $recipient);

        // send the email with the right wrapper-template
        $sent = $this->mailer->sendSingleEmail($recipient->getEmail(), $recipient->getDisplayName(), $subject, $params, $wrapperTemplateName.'.txt.twig', $recipient->getPreferredLocale());

        if ($sent) {
            // save the updated notifications
            $this->setNotificationsAsSent($notifications);

            return null;
        }

        return $recipient->getEmail();
    }
1048119
public function followChannel($userIdentifier, $channelIdentifier, $accessToken, $notifications = false)
    {
        if ($this->apiVersionIsGreaterThanV3()) {
            if (!is_numeric($userIdentifier)) {
                throw new InvalidIdentifierException('user');
            }

            if (!is_numeric($channelIdentifier)) {
                throw new InvalidIdentifierException('channel');
            }
        }

        if (!is_bool($notifications)) {
            throw new InvalidTypeException('Notifications', 'boolean', gettype($notifications));
        }

        return $this->put(
            sprintf('users/%s/follows/channels/%s', $userIdentifier, $channelIdentifier),
            ['notifications' => $notifications],
            $accessToken
        );
    }
266096
public function populate($id, $recipient = null, $backupCodeIdentifier = null, $totpIdentifier = null)
    {
        if (empty($id)) {
            throw new EntityException('No messages id supplied', EntityException::NO_MESSAGE_ID_SUPPLIED);
        }
        if ($recipient === null && $backupCodeIdentifier === null && $totpIdentifier === null) {
            throw new EntityException('No recipient, backup code identifier or totp identifier supplied', EntityException::INVALID_FIELDS);
        }

        $params = [];
        if ($recipient !== null) {
            $params['recipient'] = $recipient;
        }
        if ($backupCodeIdentifier !== null) {
            $params['backupCodeIdentifier'] = $backupCodeIdentifier;
        }
        if ($totpIdentifier !== null) {
            $params['totpIdentifier'] = $totpIdentifier;
        }

        $this->sendApiCall(self::ACTION_RETRIEVE, $this->getCreateUrl() . '/' . urlencode($id) . '?' . http_build_query($params));
    }
1021527
public function getMailParameters(NotificationEntity $notification, UserInfo $recipient)
    {
        $notificationData = $notification->getNotificationData();
        $locale = $this->app->make(LocaleRepository::class)->findApproved($notificationData['localeID']);
        if ($locale === null) {
            throw new Exception(t('Unable to find the locale with ID %s', $notificationData['localeID']));
        }
        $uir = $this->app->make(UserInfoRepository::class);
        $applicant = $uir->getByID($notificationData['applicantUserID']);
        if ($applicant === null) {
            throw new Exception(t('Unable to find the user with ID %s', $notificationData['applicantUserID']));
        }

        return [
            'localeName' => $locale->getDisplayName(),
            'applicant' => $applicant,
            'teamsUrl' => $this->getBlockPageURL('CommunityTranslation Team List', 'details/' . $locale->getID()),
        ] + $this->getCommonMailParameters($notification, $recipient);
    }
805647
public static function normalizeRecipients($recipients): array
    {
        $targetRecipients = [];
        if (is_string($recipients)) {
            $targetRecipients[] = new Address($recipients);
        } elseif ($recipients instanceof Address) {
            $targetRecipients[] = $recipients;
        } elseif (is_iterable($recipients)) {
            foreach ($recipients as $key => $recipient) {
                if ($recipient instanceof Address) {
                    $targetRecipients[] = $recipient;
                } elseif (is_int($key)) {
                    $targetRecipients[] = new Address($recipient);
                } else {
                    $targetRecipients[] = new Address($key, $recipient);
                }
            }
        } else {
            throw new InvalidArgumentException('Expected string/array/Address instance/array of Address instances.');
        }

        return $targetRecipients;
    }
895977
public function getRecipientSpecificNotificationsSubject($contentItems, RecipientInterface $recipient)
    {
        $count = sizeof($contentItems);

        if (1 == $count) {
            // get the content-item out of the boxed associative array => array(array('templateId' => contentItem))
            $onlyItem = current(current($contentItems));
            // get the title out of the notification in the contentItem
            return $onlyItem['notification']->getTitle();
        }

        return $this->translatorService->transChoice('_az.email.notifications.subject.%count%', $count, array('%count%' => $count));
    }
609671
public function sendCustomerConfirmation(
        $recipient,
        ApiOrderInterface $apiOrder,
        ContactInterface $customerContact = null
    ) {
        if (!$this->sendEmailConfirmationToCustomer) {
            return false;
        }

        return $this->sendConfirmationEmail(
            $recipient,
            $apiOrder,
            $this->templateCustomerConfirmationPath,
            $customerContact
        );
    }
24829
public function createSms($body, array $recipients, $sender)
    {
        $sms = $this->createEmptySms();
        $sms->setBody($body);
        $sms->setRecipients($recipients);
        $sms->setSender($sender);

        return $sms;
    }
117072
protected function SetInputFields($aFieldList, $oVisitor, $aUserData)
    {
        foreach ($aFieldList as $sMappedFieldName => $sRealFieldName) {
            $aField = array();
            $aField['sError'] = $this->GetMessageForField($sRealFieldName, $oVisitor->GetSourceObject('sCustomMSGConsumer'), $oVisitor);
            $aField['sValue'] = $aUserData[$sRealFieldName];
            $aField['sFieldId'] = $oVisitor->GetSourceObject('sTelephoneURLParameter').'['.$sRealFieldName.']';
            $aField['sName'] = $oVisitor->GetSourceObject('sTelephoneURLParameter').'['.$sRealFieldName.']';
            $oVisitor->SetMappedValue($sMappedFieldName, $aField);
        }
    }