Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoHuizhe committed Apr 5, 2017
1 parent 542b3d4 commit 121bdad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public function __construct($data = [])
*/
protected function sendOne($token, $message, $options)
{

if (!$message->aps || is_scalar($message->aps)) {
throw new \Exception("invalid message: " . json_encode($message));
}
Expand All @@ -55,8 +54,8 @@ protected function sendOne($token, $message, $options)
if (!$cert) {
throw new \Exception("cert path invalid: {$this->certPath}");
}
curl_setopt_array($this->ch, array(
CURLOPT_URL => "{$host}/3/device/{$token}",
curl_setopt_array($this->ch, [
CURLOPT_URL => "$host/3/device/$token",
CURLOPT_PORT => 443,
CURLOPT_HTTPHEADER => $options->getHeadersForHttp2API(),
CURLOPT_POST => true,
Expand All @@ -66,13 +65,14 @@ protected function sendOne($token, $message, $options)
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSLCERT => $cert,
CURLOPT_HEADER => 1
));
]);

$result = curl_exec($this->ch);
if ($result === false) {
throw new \Exception('Curl failed with error: ' . curl_error($this->ch));
}
$response = new Response($result, curl_getinfo($this->ch, CURLINFO_HTTP_CODE), microtime(true) - $beginTime, $token);
$response = new Response($result, curl_getinfo($this->ch, CURLINFO_HTTP_CODE), microtime(true) - $beginTime,
$token);
return $response;
}

Expand All @@ -87,7 +87,7 @@ protected function sendOne($token, $message, $options)
public function send($tokens, $message, $options)
{
$message = $message instanceof Message ? $message : new Message($message);
$options = $options instanceof Options ? $options : new Options($message);
$options = $options instanceof Options ? $options : new Options($options);

$result = [];
foreach ($tokens as $token) {
Expand Down

0 comments on commit 121bdad

Please sign in to comment.