Skip to content

Commit

Permalink
Added getters to notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
sinemacula-ben committed Aug 9, 2024
1 parent 1d8caa8 commit 76177e9
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
15 changes: 15 additions & 0 deletions src/Events/CloudWatchNotificationReceived.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SineMacula\Aws\Sns\Events;

use InvalidArgumentException;
use SineMacula\Aws\Sns\Entities\Messages\Contracts\CloudWatchNotificationInterface;

/**
Expand All @@ -21,4 +22,18 @@ public function __construct(CloudWatchNotificationInterface $notification)
{
parent::__construct($notification);
}

/**
* Return the notification.
*
* @return \SineMacula\Aws\Sns\Entities\Messages\Contracts\CloudWatchNotificationInterface
*/
public function getNotification(): CloudWatchNotificationInterface
{
if (!$this->notification instanceof CloudWatchNotificationInterface) {
throw new InvalidArgumentException('Invalid notification type');
}

return $this->notification;
}
}
10 changes: 10 additions & 0 deletions src/Events/NotificationReceived.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@ public function __construct(
protected NotificationInterface $notification

) {}

/**
* Return the notification.
*
* @return \SineMacula\Aws\Sns\Entities\Messages\Contracts\NotificationInterface
*/
public function getNotification(): NotificationInterface
{
return $this->notification;
}
}
15 changes: 15 additions & 0 deletions src/Events/S3NotificationReceived.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SineMacula\Aws\Sns\Events;

use InvalidArgumentException;
use SineMacula\Aws\Sns\Entities\Messages\Contracts\S3NotificationInterface;

/**
Expand All @@ -21,4 +22,18 @@ public function __construct(S3NotificationInterface $notification)
{
parent::__construct($notification);
}

/**
* Return the notification.
*
* @return \SineMacula\Aws\Sns\Entities\Messages\Contracts\S3NotificationInterface
*/
public function getNotification(): S3NotificationInterface
{
if (!$this->notification instanceof S3NotificationInterface) {
throw new InvalidArgumentException('Invalid notification type');
}

return $this->notification;
}
}
15 changes: 15 additions & 0 deletions src/Events/SesNotificationReceived.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SineMacula\Aws\Sns\Events;

use InvalidArgumentException;
use SineMacula\Aws\Sns\Entities\Messages\Contracts\SesNotificationInterface;

/**
Expand All @@ -21,4 +22,18 @@ public function __construct(SesNotificationInterface $notification)
{
parent::__construct($notification);
}

/**
* Return the notification.
*
* @return \SineMacula\Aws\Sns\Entities\Messages\Contracts\SesNotificationInterface
*/
public function getNotification(): SesNotificationInterface
{
if (!$this->notification instanceof SesNotificationInterface) {
throw new InvalidArgumentException('Invalid notification type');
}

return $this->notification;
}
}
10 changes: 10 additions & 0 deletions src/Events/SubscriptionConfirmed.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@ public function __construct(
protected SubscriptionConfirmationInterface $message

) {}

/**
* Return the message.
*
* @return \SineMacula\Aws\Sns\Entities\Messages\Contracts\SubscriptionConfirmationInterface
*/
public function getMessage(): SubscriptionConfirmationInterface
{
return $this->message;
}
}

0 comments on commit 76177e9

Please sign in to comment.