Skip to content

Commit 4ccd275

Browse files
authored
Merge pull request #1 from binary-cats/analysis-gO1add
Apply fixes from StyleCI
2 parents f0afd62 + ca61a2f commit 4ccd275

File tree

8 files changed

+32
-41
lines changed

8 files changed

+32
-41
lines changed

src/Jobs/Job.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract class Job
1919
protected $webhookCall;
2020

2121
/**
22-
* Location of the root
22+
* Location of the root.
2323
*
2424
* @var string
2525
*/
@@ -36,17 +36,17 @@ public function __construct(WebhookCall $webhookCall)
3636
}
3737

3838
/**
39-
* Fetch Payload
39+
* Fetch Payload.
4040
*
4141
* @return array
4242
*/
43-
protected function payload() : array
43+
protected function payload(): array
4444
{
4545
return $this->webhookCall->payload;
4646
}
4747

4848
/**
49-
* Get the value from the payload's event data
49+
* Get the value from the payload's event data.
5050
*
5151
* @param string $key
5252
* @return mixed

src/Jobs/MeetingCreatedJob.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace BinaryCats\BigBlueButtonWebhooks\Jobs;
44

5-
use BinaryCats\BigBlueButtonWebhooks\Jobs\Job;
6-
use Spatie\WebhookClient\Models\WebhookCall;
7-
85
class MeetingCreatedJob extends Job
96
{
107
/**
@@ -14,6 +11,5 @@ class MeetingCreatedJob extends Job
1411
*/
1512
public function handle()
1613
{
17-
1814
}
1915
}

src/Webhook.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace BinaryCats\BigBlueButtonWebhooks;
44

5-
use Illuminate\Http\Request;
6-
75
class Webhook
86
{
97
/**

src/WebhookCall.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
use Illuminate\Http\Request;
66
use Illuminate\Support\Arr;
7-
use Spatie\WebhookClient\WebhookConfig;
87
use Spatie\WebhookClient\Models\WebhookCall as Model;
8+
use Spatie\WebhookClient\WebhookConfig;
99

1010
class WebhookCall extends Model
1111
{
12-
public static function storeWebhook(WebhookConfig $config, Request $request): WebhookCall
12+
public static function storeWebhook(WebhookConfig $config, Request $request): self
1313
{
14-
# payload is not proper JSON, rather is it split between three blocks
14+
// payload is not proper JSON, rather is it split between three blocks
1515
$payload = $request->input();
16-
# transform event
17-
if ($event = Arr::get($payload, 'event', null) AND is_string($event)) {
16+
// transform event
17+
if ($event = Arr::get($payload, 'event', null) and is_string($event)) {
1818
$payload['event'] = json_decode($event, true);
1919
}
20-
# create
20+
// create
2121
return self::create([
2222
'name' => $config->name,
2323
'payload' => $payload,

src/WebhookSignature.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace BinaryCats\BigBlueButtonWebhooks;
44

5-
use Illuminate\Http\Request;
6-
75
class WebhookSignature
86
{
97
/**

tests/BigBlueButtonWebhookCallTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ public function setUp(): void
2727
$this->webhookCall = $model::create([
2828
'name' => 'bigbluebutton',
2929
'payload' => [
30-
"event" => [
30+
'event' => [
3131
[
32-
"data" => [
33-
"type" => "event",
34-
"id" => "my.type",
35-
"attributes" => [
32+
'data' => [
33+
'type' => 'event',
34+
'id' => 'my.type',
35+
'attributes' => [
3636
],
37-
"event" => [
38-
"ts" => 1591652302962,
37+
'event' => [
38+
'ts' => 1591652302962,
3939
],
4040
],
4141
],
4242
],
43-
"timestamp" => "1591652302965",
44-
"domain" => "example.com",
43+
'timestamp' => '1591652302965',
44+
'domain' => 'example.com',
4545
],
4646
]);
4747

tests/IntegrationTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace BinaryCats\BigBlueButtonWebhooks\Tests;
44

5-
use Illuminate\Support\Arr;
65
use Illuminate\Support\Facades\Event;
76
use Illuminate\Support\Facades\Route;
87
use Spatie\WebhookClient\Models\WebhookCall;
@@ -29,7 +28,7 @@ public function it_can_handle_a_valid_request()
2928

3029
$this
3130
->withHeaders([
32-
'Authorization' => 'Bearer '. $this->determineBigblueButtonsignature($payload),
31+
'Authorization' => 'Bearer '.$this->determineBigblueButtonsignature($payload),
3332
])
3433
->post('bigbluebutton-webhooks', $payload)
3534
->assertSuccessful();
@@ -75,7 +74,7 @@ public function a_request_with_an_invalid_payload_will_be_logged_but_events_and_
7574

7675
$this
7776
->withHeaders([
78-
'Authorization' => 'Bearer '. $this->determineBigblueButtonsignature($payload),
77+
'Authorization' => 'Bearer '.$this->determineBigblueButtonsignature($payload),
7978
])
8079
->post('bigbluebutton-webhooks', $payload)
8180
->assertStatus(400);
@@ -86,7 +85,7 @@ public function a_request_with_an_invalid_payload_will_be_logged_but_events_and_
8685

8786
$this->assertFalse(isset($webhookCall->payload['event'][0]['data']['id']));
8887
$this->assertEquals([
89-
'invalid_payload'
88+
'invalid_payload',
9089
], $webhookCall->payload);
9190

9291
$this->assertEquals('Webhook call id `1` did not contain a type. Valid BigBlueButton webhook calls should always contain a type.', $webhookCall->exception['message']);

tests/PayloadDefinition.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55
class PayloadDefinition
66
{
77
/**
8-
* Given the compexity of the payload, let's put is all into the same method
8+
* Given the compexity of the payload, let's put is all into the same method.
99
*/
1010
public static function getPayloadDefinition(): array
1111
{
1212
return [
13-
"event" => [
13+
'event' => [
1414
[
15-
"data" => [
16-
"type" => "event",
17-
"id" => "my.type",
18-
"attributes" => [
15+
'data' => [
16+
'type' => 'event',
17+
'id' => 'my.type',
18+
'attributes' => [
1919
],
20-
"event" => [
21-
"ts" => 1591652302962,
20+
'event' => [
21+
'ts' => 1591652302962,
2222
],
2323
],
2424
],
2525
],
26-
"timestamp" => "1591652302965",
27-
"domain" => "example.com",
26+
'timestamp' => '1591652302965',
27+
'domain' => 'example.com',
2828
];
2929
}
3030
}

0 commit comments

Comments
 (0)