Skip to content

Commit

Permalink
reformated code to laravel code style guideline, added laravel pint a…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
Katzen48 committed Jun 24, 2022
1 parent 4af4294 commit 87890c9
Show file tree
Hide file tree
Showing 67 changed files with 154 additions and 195 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/check-code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Check Code Style
on: [pull_request]
jobs:
Test:
runs-on: ubuntu-latest
name: Run Laravel Pint

steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress

- name: Check code style
run: ./vendor/bin/pint --test --preset laravel
2 changes: 1 addition & 1 deletion config/twitch-eventsub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

return [
'callback_url' => env('TWITCH_HELIX_EVENTSUB_CALLBACK_URL', '/twitch/eventsub/webhook'),
];
];
7 changes: 5 additions & 2 deletions src/Enums/ChannelPointsCustomRewardRedemptionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@

namespace katzen48\Twitch\EventSub\Enums;


class ChannelPointsCustomRewardRedemptionStatus
{
public const FULFILLED = 'FULFILLED';

public const UNFULFILLED = 'UNFULFILLED';

public const CANCELLED = 'CANCELLED';

public const EVENTSUB_FULFILLED = 'fulfilled';

public const EVENTSUB_UNFULFILLED = 'unfulfilled';

public const EVENTSUB_CANCELLED = 'cancelled';
}
}
8 changes: 6 additions & 2 deletions src/Enums/SubscriptionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@

namespace katzen48\Twitch\EventSub\Enums;


class SubscriptionStatus
{
public const ENABLED = 'enabled';

public const VERIFICATION_PENDING = 'webhook_callback_verification_pending';

public const VERIFICATION_FAILED = 'webhook_callback_verification_failed';

public const FAILURES_EXCEEDED = 'notification_failures_exceeded';

public const REVOKED = 'authorization_revoked';

public const USER_REMOVED = 'user_removed';
}
}
2 changes: 1 addition & 1 deletion src/EventMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ trait EventMap
\katzen48\Twitch\EventSub\Listeners\EventSubListener::class,
],
];
}
}
8 changes: 5 additions & 3 deletions src/Events/BaseEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ class BaseEvent
use Dispatchable;

public Subscription $subscription;

public string $id;

public int $retries;

public CarbonInterface $timestamp;

public function __construct(array $payload, string $id, int $retries, CarbonInterface $timestamp)
Expand All @@ -36,7 +39,7 @@ public function parsePayload($payload): void

if (array_key_exists('event', $payload)) {
$this->parseEvent($payload['event']);
} else if(array_key_exists('events', $payload)) {
} elseif (array_key_exists('events', $payload)) {
$this->parseEvent($payload['events']);
}
}
Expand Down Expand Up @@ -70,6 +73,5 @@ protected function parseCarbon($timestamp): CarbonInterface

public function parseEvent($event): void
{

}
}
}
3 changes: 1 addition & 2 deletions src/Events/Channel/ChannelBanEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace katzen48\Twitch\EventSub\Events\Channel;

use Carbon\CarbonInterface;
use Illuminate\Support\Carbon;
use katzen48\Twitch\EventSub\Events\BaseEvent;

class ChannelBanEvent extends BaseEvent
Expand Down Expand Up @@ -55,4 +54,4 @@ public function parseEvent($event): void
$this->endsAt = $this->parseCarbon($event['ends_at']);
$this->permanent = $event['is_permanent'];
}
}
}
2 changes: 1 addition & 1 deletion src/Events/Channel/ChannelCheerEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ public function parseEvent($event): void
$this->message = $event['message'];
$this->bits = $event['bits'];
}
}
}
4 changes: 1 addition & 3 deletions src/Events/Channel/ChannelFollowEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace katzen48\Twitch\EventSub\Events\Channel;

use Carbon\CarbonInterface;
use Illuminate\Support\Carbon;
use katzen48\Twitch\EventSub\Events\BaseEvent;

class ChannelFollowEvent extends BaseEvent
Expand All @@ -27,7 +26,6 @@ class ChannelFollowEvent extends BaseEvent

public CarbonInterface $followedAt;


public function parseEvent($event): void
{
$this->followerId = $event['user_id'];
Expand All @@ -38,4 +36,4 @@ public function parseEvent($event): void
$this->broadcasterName = $event['broadcaster_user_name'];
$this->followedAt = $this->parseCarbon($event['followed_at']);
}
}
}
4 changes: 1 addition & 3 deletions src/Events/Channel/ChannelModeratorAddEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace katzen48\Twitch\EventSub\Events\Channel;

use Illuminate\Support\Carbon;
use katzen48\Twitch\EventSub\Events\BaseEvent;

class ChannelModeratorAddEvent extends BaseEvent
Expand All @@ -24,7 +23,6 @@ class ChannelModeratorAddEvent extends BaseEvent

public string $broadcasterName;


public function parseEvent($event): void
{
$this->moderatorId = $event['user_id'];
Expand All @@ -34,4 +32,4 @@ public function parseEvent($event): void
$this->broadcasterLogin = $event['broadcaster_user_login'];
$this->broadcasterName = $event['broadcaster_user_name'];
}
}
}
4 changes: 1 addition & 3 deletions src/Events/Channel/ChannelModeratorRemoveEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace katzen48\Twitch\EventSub\Events\Channel;

use Illuminate\Support\Carbon;
use katzen48\Twitch\EventSub\Events\BaseEvent;

class ChannelModeratorRemoveEvent extends BaseEvent
Expand All @@ -24,7 +23,6 @@ class ChannelModeratorRemoveEvent extends BaseEvent

public string $broadcasterName;


public function parseEvent($event): void
{
$this->moderatorId = $event['user_id'];
Expand All @@ -34,4 +32,4 @@ public function parseEvent($event): void
$this->broadcasterLogin = $event['broadcaster_user_login'];
$this->broadcasterName = $event['broadcaster_user_name'];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ public function parseEvent($event): void
$this->defaultImage->url2x = $event['default_image']['url_2x'];
$this->defaultImage->url4x = $event['default_image']['url_4x'];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ public function parseEvent($event): void

$this->redeemedAt = $this->parseCarbon($event['redeemed_at']);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ public function parseEvent($event): void

$this->redeemedAt = $this->parseCarbon($event['redeemed_at']);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ public function parseEvent($event): void
$this->defaultImage->url2x = $event['default_image']['url_2x'];
$this->defaultImage->url4x = $event['default_image']['url_4x'];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ public function parseEvent($event): void
$this->defaultImage->url2x = $event['default_image']['url_2x'];
$this->defaultImage->url4x = $event['default_image']['url_4x'];
}
}
}
3 changes: 1 addition & 2 deletions src/Events/Channel/ChannelRaidEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

class ChannelRaidEvent extends BaseEvent
{

public string $fromBroadcasterId;

public string $fromBroadcasterLogin;
Expand All @@ -36,4 +35,4 @@ public function parseEvent($event): void
$this->toBroadcasterName = $event['to_broadcaster_user_name'];
$this->viewers = $event['viewers'];
}
}
}
3 changes: 1 addition & 2 deletions src/Events/Channel/ChannelUnbanEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace katzen48\Twitch\EventSub\Events\Channel;

use Illuminate\Support\Carbon;
use katzen48\Twitch\EventSub\Events\BaseEvent;

class ChannelUnbanEvent extends BaseEvent
Expand Down Expand Up @@ -42,4 +41,4 @@ public function parseEvent($event): void
$this->moderatorLogin = $event['moderator_user_login'];
$this->moderatorName = $event['moderator_user_name'];
}
}
}
2 changes: 1 addition & 1 deletion src/Events/Channel/ChannelUpdateEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public function parseEvent($event): void
$this->categoryName = $event['category_name'];
$this->mature = $event['is_mature'];
}
}
}
3 changes: 1 addition & 2 deletions src/Events/Channel/Goal/ChannelGoalBeginEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace katzen48\Twitch\EventSub\Events\Channel\Goal;

use Carbon\CarbonInterface;
use Illuminate\Support\Carbon;
use katzen48\Twitch\EventSub\Events\BaseEvent;

class ChannelGoalBeginEvent extends BaseEvent
Expand Down Expand Up @@ -61,4 +60,4 @@ public function isNewSubscription(): bool
{
return $this->type === 'new_subscription';
}
}
}
3 changes: 1 addition & 2 deletions src/Events/Channel/Goal/ChannelGoalEndEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace katzen48\Twitch\EventSub\Events\Channel\Goal;

use Carbon\CarbonInterface;
use Illuminate\Support\Carbon;
use katzen48\Twitch\EventSub\Events\BaseEvent;

class ChannelGoalEndEvent extends BaseEvent
Expand Down Expand Up @@ -64,4 +63,4 @@ public function isNewSubscription(): bool
{
return $this->type === 'new_subscription';
}
}
}
3 changes: 1 addition & 2 deletions src/Events/Channel/Goal/ChannelGoalProgressEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace katzen48\Twitch\EventSub\Events\Channel\Goal;

use Carbon\CarbonInterface;
use Illuminate\Support\Carbon;
use katzen48\Twitch\EventSub\Events\BaseEvent;

class ChannelGoalProgressEvent extends BaseEvent
Expand Down Expand Up @@ -61,4 +60,4 @@ public function isNewSubscription(): bool
{
return $this->type === 'new_subscription';
}
}
}
4 changes: 2 additions & 2 deletions src/Events/Channel/HypeTrain/ChannelHypeTrainBeginEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ChannelHypeTrainBeginEvent extends BaseEvent
public int $goal;

/**
* @var Collection|HypeTrainContribution $topContributions
* @var Collection|HypeTrainContribution
*/
public $topContributions;

Expand Down Expand Up @@ -72,4 +72,4 @@ public function parseEvent($event): void
$this->lastContribution->total = $event['last_contribution']['total'];
}
}
}
}
4 changes: 2 additions & 2 deletions src/Events/Channel/HypeTrain/ChannelHypeTrainEndEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ChannelHypeTrainEndEvent extends BaseEvent
public int $total;

/**
* @var Collection|HypeTrainContribution $topContributions
* @var Collection|HypeTrainContribution
*/
public $topContributions;

Expand Down Expand Up @@ -58,4 +58,4 @@ public function parseEvent($event): void
$this->topContributions->add($contribution);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ChannelHypeTrainProgressEvent extends BaseEvent
public int $goal;

/**
* @var Collection|HypeTrainContribution $topContributions
* @var Collection|HypeTrainContribution
*/
public $topContributions;

Expand Down Expand Up @@ -72,4 +72,4 @@ public function parseEvent($event): void
$this->lastContribution->total = $event['last_contribution']['total'];
}
}
}
}
2 changes: 1 addition & 1 deletion src/Events/Channel/Poll/ChannelPollBeginEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ public function parseEvent($event): void
$this->startedAt = $this->parseCarbon($event['started_at']);
$this->endsAt = $this->parseCarbon($event['ends_at']);
}
}
}
2 changes: 1 addition & 1 deletion src/Events/Channel/Poll/ChannelPollEndEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ public function parseEvent($event): void
$this->startedAt = $this->parseCarbon($event['started_at']);
$this->endedAt = $this->parseCarbon($event['ended_at']);
}
}
}
2 changes: 1 addition & 1 deletion src/Events/Channel/Poll/ChannelPollProgressEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ public function parseEvent($event): void
$this->startedAt = $this->parseCarbon($event['started_at']);
$this->endsAt = $this->parseCarbon($event['ends_at']);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ public function parseEvent($event): void
$this->startedAt = $this->parseCarbon($event['started_at']);
$this->locksAt = $this->parseCarbon($event['locks_at']);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public function parseEvent($event): void
$this->startedAt = $this->parseCarbon($event['started_at']);
$this->endedAt = $this->parseCarbon($event['ended_at']);
}
}
}
Loading

0 comments on commit 87890c9

Please sign in to comment.