@param Model $recipient

@return bool
482704
public function hasBlocked(Model $recipient): bool
    {
        return $this->getFriendship($recipient)->status === Status::BLOCKED;
    }
819963
public function sendTo(Recipient $recipient, MessageInterface $message)
    {
        $driver = "\\Eyewitness\\Eye\\Notifications\\Drivers\\".ucfirst(strtolower($recipient->type));

        if (class_exists($driver)) {
            $channel = app($driver);
            $channel->fire($recipient, $message);
        } else {
            app(Eye::class)->logger()->debug('Notification Driver does not exist', $driver);
        }
    }
1091987
public function addRecipientConditions(QueryBuilder $builder, IdentifierRecipientInterface $recipient)
    {
        $alias = $builder->getRootAliases()[0];
        $builder
            ->where(
                $builder->expr()->andX(
                    $builder->expr()->eq($alias . '.recipientClass', ':class'),
                    $builder->expr()->eq($alias . '.recipientId', ':id')
                )
            )
            ->setParameter('class', ClassUtils::getClass($recipient))
            ->setParameter('id', $recipient->getId())
        ;

        return $builder;
    }
1302409
public function sendMessage(Message $message) {
        if ($this->isDisabled()) {
            return false;
        }

        $users = $message->getMyDestionationUsers($this->container);
        $sentCount = 0;
        foreach($users as $user) {
            //if($user->getId() != $message->getFromUser()->getId()){
            $sentCount += $this->sendMessageToUser($message, $user);
            //}
        }
        return $sentCount;
    }
558845
public function befriend(Model $recipient): bool
    {
        if ($this->isFriendsWith($recipient)) {
            return true;
        }

        $friendship = (new Friend())->forceFill([
            'recipient_id'   => $recipient->id,
            'recipient_type' => get_class($recipient),
            'status'         => Status::PENDING,
        ]);

        return (bool) $this->friends()->save($friendship);
    }
404674
public function unblockFriendRequest(Model $recipient): bool
    {
        if (!$this->isFriendsWith($recipient)) {
            return false;
        }

        return (bool) $this->findFriendship($recipient)->update([
            'status' => Status::PENDING,
        ]);
    }
1105074
public function follow(Model $recipient)
    {
        if ($this->followingCountReached()) {
            return false;
        }

        if (!$this->canFollow($recipient)) {
            return false;
        }

        $following = (new Follower)->fillRecipient($recipient)->fill([
            'status' => Status::PENDING,
        ]);

        $this->following()->save($following);

        return $following;
    }
1362068
public function isFriendsWith(Model $recipient, $status = null): bool
    {
        $exists = $this->findFriendship($recipient);

        if (!empty($status)) {
            $exists = $exists->where('status', $status);
        }

        return (bool) $exists->count();
    }
1190554
protected function setPushableRecipient($recipientType, $recipient)
    {
        if ($recipientType === "device") {
            $this->recipientType = "device_iden";
            $this->recipient = $recipient;
        } else if ($recipientType === "channel") {
            $this->recipientType = "channel_tag";
            $this->recipient = $recipient;
        } else if ($recipientType === "email") {
            if (filter_var($recipient, FILTER_VALIDATE_EMAIL) !== false) {
                $this->recipientType = "email";
                $this->recipient = $recipient;
            } else {
                throw new Exceptions\InvalidRecipientException("Invalid email address.");
            }
        } else {
            throw new Exceptions\InvalidRecipientException("Unknown recipient type.");
        }
    }
952323
public function send($destination, Message $message)
    {
        return $this->getClient()->send($destination, $message, ['transaction' => $this->transactionId], false);
    }
1339745
public function hasSentFriendRequestTo(Model $recipient)
    {
        return Friendship::whereRecipient($recipient)->whereSender($this)->whereStatus(Status::PENDING)->exists();
    }
37384
public function setRecipientVariables(string $recipient, array $recipientVariables): self
    {
        $this->recipientVariables[$recipient] = $recipientVariables;

        return $this;
    }
809963
public static function recipient($recipient) {
    if (is_string($recipient)) return $recipient;
    if (is_array($recipient)) return $recipient; // @TODO checks?
    
    throw new Exception('Unbekannter Parameter: '.Code::varInfo($recipient));
  }
218657
public function sendMail(
        $recipient,
        $templatePath,
        $data = array(),
        $blindCopyRecipients = array()
    ) {
        $tmplData = array_merge(
            $data,
            array(
                'footerTxt' => $this->templateFooterTxtPath,
                'footerHtml' => $this->templateFooterHtmlPath,
            )
        );

        // Load template from twig.
        $template = $this->twig->loadTemplate($templatePath);

        // Merge twig globals so that they also are available in renderBlock.
        $tmplData = $this->twig->mergeGlobals($tmplData);

        // Get subject from block.
        $subject = $template->renderBlock('subject', $tmplData);

        $emailBodyText = $template->renderBlock('body_text', $tmplData);
        $emailBodyHtml = $template->renderBlock('body_html', $tmplData);

        /** @var \Swift_Message $message */
        $message = \Swift_Message::newInstance()
            ->setSubject($subject)
            ->setFrom($this->emailFrom)
            ->setTo($recipient)
            ->setBody($emailBodyText, 'text/plain')
            ->addPart($emailBodyHtml, 'text/html');
        
        // add blind copy recipients
        foreach ($blindCopyRecipients as $bcc) {
            $message->addBcc($bcc);
        }

        $failedRecipients = array();
        $this->mailer->send($message, $failedRecipients);

        if (count($failedRecipients) > 0) {
            $this->writeLog('Could not send mail to the following recipients: ' . join(', ', $failedRecipients));

            return false;
        }

        return true;
    }
744149
public function send($message, $recipient, $mustInit = true)
    {
        if ($mustInit) $this->_init();

        $params = array(
            'api' => $this->api_key,
            'number' => $recipient,
            'message' => $message,
            'from' => $this->from,
        );

        $query = http_build_query($params);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, Config::get('semaphore::url.sms.sms'));
        curl_setopt($ch, CURLOPT_POST, count($params));
        curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);
        curl_close($ch);

        return $response;
    }
778262
protected function validateRecipients(array $recipients)
    {
        if (true == empty($recipients)) {
            throw new \InvalidArgumentException('Recipients list should not be empty');
        }

        foreach ($recipients as $recipient) {
            if (true == is_string($recipient) && $this->isValidMail($recipient)) {
                continue;
            }

            throw new \InvalidArgumentException(sprintf(
                'Given recipients list %s has invalid recipient %s',
                var_export($recipients, true),
                var_export($recipient, true)
            ));
        }
    }
1343233
protected function sendEmail(array $recipient, array $from, $subject, $bodyHTML = '', $bodyPlain = '', array $replyTo = NULL)
    {

        if ($replyTo == NULL) {
            $replyTo = $from;
        }
        $mail = GeneralUtility::makeInstance(MailMessage::class);
        $mail
            ->setTo($recipient)
            ->setFrom($from)
            ->setReplyTo($replyTo)
            ->setSubject($subject);

        if ($bodyHTML !== '' && $bodyHTML !== NULL ) {
            $mail->addPart($bodyHTML, 'text/html');
        }
        if ($bodyPlain !== '' && $bodyPlain !== NULL ) {
            $mail->addPart($bodyPlain, 'text/plain');
        }

        return $mail->send();
    }