| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Give\Donations\ValueObjects; |
| 6 |
|
| 7 |
use Give\Framework\Support\ValueObjects\Enum; |
| 8 |
|
| 9 |
/** |
| 10 |
* @since 2.23.0 |
| 11 |
* |
| 12 |
* @method static DonationType SINGLE() |
| 13 |
* @method static DonationType SUBSCRIPTION() |
| 14 |
* @method static DonationType RENEWAL() |
| 15 |
* @method bool isSingle() |
| 16 |
* @method bool isSubscription() |
| 17 |
* @method bool isRenewal() |
| 18 |
*/ |
| 19 |
class DonationType extends Enum |
| 20 |
{ |
| 21 |
// A single donation with no recurrence |
| 22 |
const SINGLE = 'single'; |
| 23 |
|
| 24 |
// The first donation for a new subscription |
| 25 |
const SUBSCRIPTION = 'subscription'; |
| 26 |
|
| 27 |
// A subsequent donation for an existing subscription |
| 28 |
const RENEWAL = 'renewal'; |
| 29 |
|
| 30 |
/** |
| 31 |
* Whether this donation is recurring or not |
| 32 |
* @since 2.24.0 |
| 33 |
*/ |
| 34 |
public function isRecurring(): bool |
| 35 |
{ |
| 36 |
return ! $this->isSingle(); |
| 37 |
} |
| 38 |
} |
| 39 |
|