PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / src / Framework / PaymentGateways / Webhooks / EventHandlers / Actions / GetEventHandlerClassBySubscriptionStatus.php

GetEventHandlerClassBySubscriptionStatus.php in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at src/Framework/PaymentGateways/Webhooks/EventHandlers/Actions/GetEventHandlerClassBySubscriptionStatus.php

47 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Framework\PaymentGateways\Webhooks\EventHandlers\Actions;
4
5 use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionActive;
6 use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionCancelled;
7 use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionCompleted;
8 use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionExpired;
9 use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionFailing;
10 use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionPaused;
11 use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionPending;
12 use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionSuspended;
13 use Give\Subscriptions\ValueObjects\SubscriptionStatus;
14
15 /**
16 * @since 4.5.0
17 */
18 class GetEventHandlerClassBySubscriptionStatus
19 {
20 /**
21 * @since 4.5.0
22 */
23 public function __invoke(SubscriptionStatus $status): string
24 {
25 switch ($status) {
26 case $status->isActive():
27 return SubscriptionActive::class;
28 case $status->isCancelled():
29 return SubscriptionCancelled::class;
30 case $status->isCompleted():
31 return SubscriptionCompleted::class;
32 case $status->isExpired():
33 return SubscriptionExpired::class;
34 case $status->isFailing():
35 return SubscriptionFailing::class;
36 case $status->isPaused():
37 return SubscriptionPaused::class;
38 case $status->isPending():
39 return SubscriptionPending::class;
40 case $status->isSuspended():
41 return SubscriptionSuspended::class;
42 default:
43 return '';
44 }
45 }
46 }
47