@@ -19,7 +19,7 @@ class Pusher implements LoggerAwareInterface, PusherInterface
19
19
/**
20
20
* @var string Version
21
21
*/
22
- public static $ VERSION = '7.2.2 ' ;
22
+ public static $ VERSION = '7.2.3 ' ;
23
23
24
24
/**
25
25
* @var null|PusherCrypto
@@ -475,8 +475,8 @@ public function triggerAsync($channels, string $event, $data, array $params = []
475
475
*/
476
476
public function sendToUser (string $ user_id , string $ event , $ data , bool $ already_encoded = false ): object
477
477
{
478
- $ this ->validate_user_id ($ user_id );
479
- return $ this ->trigger (["#server-to-user- $ user_id " ], $ event , $ data , [], $ already_encoded );
478
+ $ this ->validate_user_id ($ user_id );
479
+ return $ this ->trigger (["#server-to-user- $ user_id " ], $ event , $ data , [], $ already_encoded );
480
480
}
481
481
482
482
/**
@@ -492,8 +492,8 @@ public function sendToUser(string $user_id, string $event, $data, bool $already_
492
492
*/
493
493
public function sendToUserAsync (string $ user_id , string $ event , $ data , bool $ already_encoded = false ): PromiseInterface
494
494
{
495
- $ this ->validate_user_id ($ user_id );
496
- return $ this ->triggerAsync (["#server-to-user- $ user_id " ], $ event , $ data , [], $ already_encoded );
495
+ $ this ->validate_user_id ($ user_id );
496
+ return $ this ->triggerAsync (["#server-to-user- $ user_id " ], $ event , $ data , [], $ already_encoded );
497
497
}
498
498
499
499
@@ -914,7 +914,7 @@ public function authorizeChannel(string $channel, string $socket_id, string $cus
914
914
return $ response ;
915
915
}
916
916
917
- /**
917
+ /**
918
918
* Convenience function for presence channel authorization.
919
919
*
920
920
* Equivalent to authorizeChannel($channel, $socket_id, json_encode(['user_id' => $user_id, 'user_info' => $user_info], JSON_THROW_ON_ERROR))
@@ -1061,7 +1061,7 @@ public function ensure_valid_signature(array $headers, string $body): void
1061
1061
*/
1062
1062
private function make_event (array $ channels , string $ event , $ data , array $ params = [], ?string $ info = null , bool $ already_encoded = false ): array
1063
1063
{
1064
- $ has_encrypted_channel = false ;
1064
+ $ has_encrypted_channel = false ;
1065
1065
foreach ($ channels as $ chan ) {
1066
1066
if (PusherCrypto::is_encrypted_channel ($ chan )) {
1067
1067
$ has_encrypted_channel = true ;
@@ -1102,12 +1102,12 @@ private function make_event(array $channels, string $event, $data, array $params
1102
1102
$ post_params ['data ' ] = $ data_encoded ;
1103
1103
$ channel_values = array_values ($ channels );
1104
1104
if (count ($ channel_values ) == 1 ) {
1105
- $ post_params ['channel ' ] = $ channel_values [0 ];
1105
+ $ post_params ['channel ' ] = $ channel_values [0 ];
1106
1106
} else {
1107
- $ post_params ['channels ' ] = $ channel_values ;
1107
+ $ post_params ['channels ' ] = $ channel_values ;
1108
1108
}
1109
1109
if (!is_null ($ info )) {
1110
- $ post_params ['info ' ] = $ info ;
1110
+ $ post_params ['info ' ] = $ info ;
1111
1111
}
1112
1112
1113
1113
return array_merge ($ post_params , $ params );
@@ -1166,9 +1166,10 @@ private function make_trigger_batch_body(array $batch = [], bool $already_encode
1166
1166
$ this ->validate_channel ($ event ['channel ' ]);
1167
1167
if (isset ($ event ['socket_id ' ])) {
1168
1168
$ this ->validate_socket_id ($ event ['socket_id ' ]);
1169
+ $ batch [$ key ] = $ this ->make_event ([$ event ['channel ' ]], $ event ['name ' ], $ event ['data ' ], ['socket_id ' => $ event ['socket_id ' ]], $ event ['info ' ] ?? null , $ already_encoded );
1170
+ } else {
1171
+ $ batch [$ key ] = $ this ->make_event ([$ event ['channel ' ]], $ event ['name ' ], $ event ['data ' ], [], $ event ['info ' ] ?? null , $ already_encoded );
1169
1172
}
1170
-
1171
- $ batch [$ key ] = $ this ->make_event ([$ event ['channel ' ]], $ event ['name ' ], $ event ['data ' ], [], $ event ['info ' ] ?? null , $ already_encoded );
1172
1173
}
1173
1174
1174
1175
try {
0 commit comments