Skip to content

Commit

Permalink
Fix code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon authored and github-actions[bot] committed Nov 18, 2023
1 parent 365681e commit 2ea636d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Pusher/Http/Controllers/ChannelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ChannelController extends Controller
*/
public function handle(RequestInterface $request, Connection $connection, ...$args): Response
{
if(! $channel = $args['channel'] ?? null) {
if (! $channel = $args['channel'] ?? null) {
return new JsonResponse((object) []);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Pusher/Http/Controllers/EventsBatchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class EventsBatchController extends Controller
public function handle(RequestInterface $request, Connection $connection, ...$args): Response
{
// @TODO Validate the request body as a JSON array of events in the correct format and a max of 10 items.

$items = collect(json_decode($this->body, true));

$info = $items->map(function ($item) {
Expand Down
2 changes: 1 addition & 1 deletion src/Pusher/Http/Controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class EventsController extends Controller
public function handle(RequestInterface $request, Connection $connection, ...$args): Response
{
// @TODO Validate the request body as a JSON object in the correct format.

$payload = json_decode($this->body, true);
$channels = Arr::wrap($payload['channels'] ?? $payload['channel'] ?? []);

Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Ratchet/EventsBatchControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'name' => 'AnotherNewEvent',
'channel' => 'test-channel-two',
'data' => ['some' => ['more' => 'data']],
]
],
]));

$this->assertSame(200, $response->getStatusCode());
Expand All @@ -54,7 +54,7 @@
'channel' => 'test-channel-three',
'data' => ['some' => ['more' => 'data']],
'info' => 'subscription_count,user_count',
]
],
]));

$this->assertSame(200, $response->getStatusCode());
Expand All @@ -73,7 +73,7 @@
'name' => 'AnotherNewEvent',
'channel' => 'test-channel-two',
'data' => ['some' => ['more' => 'data']],
]
],
]));

$this->assertSame(200, $response->getStatusCode());
Expand Down
8 changes: 5 additions & 3 deletions tests/RatchetTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,16 @@ public function signedRequest(string $path, string $method = 'GET', mixed $data
/**
* Post a request to the server.
*/
public function postReqeust(string $path, array $data = [], string $host = '0.0.0.0', string $port = '8080', string $appId = '123456'): PromiseInterface {
public function postReqeust(string $path, array $data = [], string $host = '0.0.0.0', string $port = '8080', string $appId = '123456'): PromiseInterface
{
return $this->request($path, 'POST', $data, $host, $port, $appId);
}

/**
* Post a signed request to the server.
*/
public function signedPostRequest(string $path, array $data = [], string $host = '0.0.0.0', string $port = '8080', string $appId = '123456'): PromiseInterface {
public function signedPostRequest(string $path, array $data = [], string $host = '0.0.0.0', string $port = '8080', string $appId = '123456'): PromiseInterface
{
$hash = md5(json_encode($data));
$timestamp = time();
$query = "auth_key=pusher-key&auth_timestamp={$timestamp}&auth_version=1.0&body_md5={$hash}";
Expand All @@ -331,7 +333,7 @@ public function getWithSignature(
$signature = hash_hmac('sha256', $string, 'pusher-secret');

$path = Str::contains($path, '?') ? "{$path}&{$query}" : "{$path}?{$query}";

return $this->request("{$path}&auth_signature={$signature}", 'GET', '', $host, $port, $appId);
}
}
1 change: 0 additions & 1 deletion tests/Unit/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Laravel\Reverb\Contracts\ChannelManager;
use Laravel\Reverb\Contracts\ServerProvider;
use Laravel\Reverb\Event;
use Laravel\Reverb\Managers\Connections;

it('can publish an event when enabled', function () {
$app = app(ApplicationProvider::class)->findByKey('pusher-key');
Expand Down

0 comments on commit 2ea636d

Please sign in to comment.