# give/4.18.0/src/Framework/PaymentGateways/Webhooks/EventHandlers/Actions/GetEventHandlerClassBySubscriptionStatus.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.18.0. 47 lines.

- Page: https://pluginprobe.com/plugins/give/4.18.0/code/src/Framework/PaymentGateways/Webhooks/EventHandlers/Actions/GetEventHandlerClassBySubscriptionStatus.php
- Raw: https://pluginprobe.com/plugins/give/4.18.0/raw/src/Framework/PaymentGateways/Webhooks/EventHandlers/Actions/GetEventHandlerClassBySubscriptionStatus.php
- Modified: 2025-07-09T13:09:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.18.0/code/src/Framework/PaymentGateways/Webhooks/EventHandlers/Actions/GetEventHandlerClassBySubscriptionStatus.php#L10-L20`.

```php
<?php

namespace Give\Framework\PaymentGateways\Webhooks\EventHandlers\Actions;

use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionActive;
use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionCancelled;
use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionCompleted;
use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionExpired;
use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionFailing;
use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionPaused;
use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionPending;
use Give\Framework\PaymentGateways\Webhooks\EventHandlers\SubscriptionSuspended;
use Give\Subscriptions\ValueObjects\SubscriptionStatus;

/**
 * @since 4.5.0
 */
class GetEventHandlerClassBySubscriptionStatus
{
    /**
     * @since 4.5.0
     */
    public function __invoke(SubscriptionStatus $status): string
    {
        switch ($status) {
            case $status->isActive():
                return SubscriptionActive::class;
            case $status->isCancelled():
                return SubscriptionCancelled::class;
            case $status->isCompleted():
                return SubscriptionCompleted::class;
            case $status->isExpired():
                return SubscriptionExpired::class;
            case $status->isFailing():
                return SubscriptionFailing::class;
            case $status->isPaused():
                return SubscriptionPaused::class;
            case $status->isPending():
                return SubscriptionPending::class;
            case $status->isSuspended():
                return SubscriptionSuspended::class;
            default:
                return '';
        }
    }
}

```
