Process sending

@param array $params
@param Sring $to
@return mixed
@throws Exception
426312
protected function process($params, $to)
    {
        $params['DestinationAddress'] = $to;
        $result                       = $this->request('Send', $params);
        if (!isset($this->config['codes'][$result])) {
            return $result;
        }
        $this->setResultCode($result);
        $this->setResultMessage($this->config['codes'][$result]);
        throw new Exception(sprintf('Unable to send sms to %s with content: %s. Provider error message: %s.', $to, $params['Body'], $this->config['codes'][$result]));
    }
749113
public function send(SmsMessage $message, $to)
    {

        $text = trim($message->content);
        if ($this->validate()) {
            return $this->push($to, $text);
        }

        return false;
    }
533183
public function moveMessage($index = -1, $to = '')
    {
        if (empty($to)) {
            return false;
        }

        $msgId = 0;

        if (is_array($this->messages) == true) {
            foreach($this ->messages as $msg) {
                if ($msg['index'] == $index) {
                    $msgId = $msg['index'];
                    break;
                }
            }
        }


        if ($msgId >= 0) {
            $to = imap_utf7_encode($to);

            imap_mail_move($this->conn, $msgId, "INBOX.".$to);
            imap_expunge($this->conn);
        }

        return false;
    }
481537
function send(to, done) {
    if (to.constructor !== Array) to = [to]

    var sent = []
    var cb = !done ? null : ((e,r) => {
      sent.push(e||r)
      if (sent.length == to.length)
        done(null, to.length == 1 ? sent[0] : sent)
    })

    for (var user of to) {
      var msg = opts.raw ||
                Composer.render(Object.assign({to:user},opts))
      dispatch.toUser(user, msg, opts, cb)
    }
  }
1063691
public static function convertEncoding($str, $from, $to)
	{
	    if(function_exists('iconv')) {
	        return iconv($from, $to . '//ignore', $str);
	    } elseif(function_exists('mb_convert_encoding')) {
	        return mb_convert_encoding($str, $to, $from);
	    }

	    throw new \Exception('请先安装PHP iconv或mb_string扩展');
	}
1181746
public function notify($to, $message)
    {
        $params = ['text' => $message];

        return $this->send($this->buildUrlFromString("rooms/{$to}/chatMessages"), $params);
    }
952358
public function sendVoice($to, $content = null, $tempId = null, array $data = [], $code = null, $fileId = null, array $params = [])
    {
        $this->reset();
        $this->params($params, true);
        $to = $this->formatMobile(Util::formatMobiles($to));

        if ($tempId && $this instanceof TemplateVoice) {
            $this->sendTemplateVoice($to, $tempId, $data);
        } elseif ($fileId && $this instanceof FileVoice) {
            $this->sendFileVoice($to, $fileId);
        } elseif ($code && $this instanceof VoiceCode) {
            $this->sendVoiceCode($to, $code);
        } elseif ($content && $this instanceof ContentVoice) {
            $this->sendContentVoice($to, $content);
        }
    }
1013643
public function endpoint_sendmessage($to = NULL, $from = NULL, $body = NULL)
        {
            return $this->sendmessage($to, $from, $body);
        }
443065
public function sendPresenceUnsubscription($to)
    {
        $node = new ProtocolNode('presence', ['type' => 'unsubscribe', 'to' => $this->getJID($to)], null, '');
        $this->sendNode($node);
    }
493553
public function sendAcceptSubscriptionRequest($to)
    {
        $presence = new \sb\XMPP\Presence();
        $presence->setType('subscribed');
        $presence->setTo($to);
        return $this->sendPresence($presence);
    }
1157843
public function unpack($from, $to)
    {
        if (($gzip = gzopen($from, 'rb')) === false) {
            throw new Exception('Unable to read compressed file.');
        }

        if (($target = fopen($to, 'w')) === false) {
            throw new Exception('Unable to open the target.');
        }

        while ($string = gzread($gzip, 4096)) {
            fwrite($target, $string, strlen($string));
        }

        gzclose($gzip);
        fclose($target);
    }
1299835
public function message($to, $message, $mediaUrls = null, array $params = [])
    {
        $params['body'] = $message;

        if (!isset($params['from'])) {
            $params['from'] = $this->from;
        }

        if (!empty($mediaUrls)) {
            $params['mediaUrl'] = $mediaUrls;
        }

        return $this->getTwilio()->messages->create($to, $params);
    }
1172624
public function sendPresence($to, $from = NULL, $type = NULL) {
		$type = is_null($type) ? '' : " type=\"{$type}\"";
		return $this->send('<presence to="' . htmlspecialchars($to) . '" from="' . (is_null($from) ? $this->component_name : htmlspecialchars("$from@{$this->component_name}")) . '"' . $type . ' />');
	}
648030
public function call($to, $message, array $params = [])
    {
        if (is_callable($message)) {
            $query = http_build_query([
                'Twiml' => $this->twiml($message),
            ]);

            $message = 'https://twimlets.com/echo?'.$query;
        }

        $params['url'] = $message;

        return $this->getTwilio()->calls->create(
            $to,
            $this->from,
            $params
        );
    }
1324820
public function move( $from, $to )
	{
		try {
			$this->fs->move( $from, $to );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
1006684
public function notify($to, $message)
    {
        $params = [
            'From' => $this->config['from'],
            'To'   => $to,
            'Body' => $message,
        ];

        return $this->send($this->buildUrlFromString('Accounts/'.$this->config['client'].'/SMS/Messages.json'), $params);
    }
1016155
public function copy($from, $to)
    {
        $from = ltrim($from, "/");
        $to   = ltrim($to, "/");

        if (!$this->exists($from)) {
            $path = $this->bucket . "/" . $from;
            throw new ExceptionStorage("Object {$path} Not found", static::E_NOT_IS_DIR);
        }

        if ($this->exists($to)) {
            $path = $this->bucket . "/" . $to;
            throw new ExceptionStorage("Object {$path} exists");
        }

        // Copia Object
        $this->clientS3->copyObject(array(
            'Bucket'     => $this->bucket,
            'Key'        => $to,
            'CopySource' => $this->bucket . '/' . rawurlencode($from),
            'ACL'        => static::ACL_PUBLIC_READ,
            'MetadataDirective' => 'COPY',
        ));

        $pathFrom = trim($from, '/') . '/';

        $iterator = $this->clientS3->getIterator('ListObjects', array(
            'Bucket' => $this->bucket,
            'Prefix' => $pathFrom,
        ));

        foreach ($iterator as $object)
        {
            $pattern = preg_quote($pathFrom, "/");
            $Key = preg_replace("/^{$pattern}/", "", $object['Key']);

            if (!empty($Key))
            {
                $pattern = preg_quote($pathFrom, "/");
                $Key = preg_replace("/^{$pattern}/", "", $object['Key']);

                $origem  = $this->bucket . '/' . $object['Key'];
                $destino = trim($to, "/") . "/" . $Key;

                // Copia Object
                $this->clientS3->copyObject(array(
                    'Bucket'     => $this->bucket,
                    'Key'        => $destino,
                    'CopySource' => $origem,
                    'ACL'        => static::ACL_PUBLIC_READ,
                    'MetadataDirective' => 'COPY'
                ));
            }
        }

        return true;
    }