コード例 #1
0
ファイル: TelegramAdaptor.php プロジェクト: jlaso/notify
 /**
  * @param UserInterface $user
  * @param MessageInterface $message
  * @return bool
  */
 public function sendNotification(UserInterface $user, MessageInterface $message)
 {
     $this->telegramCli->msg($user->getPhoneNumber()->getValue(), $message->getText());
     return true;
 }
コード例 #2
0
ファイル: EmailAdaptor.php プロジェクト: jlaso/notify
 /**
  * @param UserInterface $user
  * @param MessageInterface $message
  * @return bool
  */
 public function sendNotification(UserInterface $user, MessageInterface $message)
 {
     $msg = \Swift_Message::newInstance()->setSubject("Message from me")->setFrom($this->from)->setTo(array($user->getEmail()->getValue()))->setBody($message->getText());
     $this->mailer->send($msg);
 }
コード例 #3
0
ファイル: SqliteUserRepository.php プロジェクト: jlaso/notify
    /**
     * @param UserInterface $user
     * @return bool
     */
    public function update(UserInterface $user)
    {
        $tableName = self::TABLE;
        $sql = <<<SQL
            UPDATE `{$tableName}`
            SET `phone_number` = ':phone_number',
                `email` : ':email', `preferred_notify_way` = ':preferred_notify_way'
            WHERE
              `id` = ':id'
SQL;
        $statement = $this->pdo->prepare($sql);
        $statement->bindValue(array(':id', ':phone_number', ':email', ':preferred_notify_way'), array($user->getId()->getValue(), $user->getPhoneNumber()->getValue(), $user->getEmail()->getValue(), $user->getPreferredNotifyWay()->getValue()));
        $statement->execute();
    }