Addons
4 years ago
Commands
4 years ago
Factories
4 years ago
Framework
1 year ago
Repositories
4 years ago
Addons.php
4 years ago
ServiceProvider.php
1 year ago
Addons.php
68 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\TestData; |
| 4 | |
| 5 | use Give\TestData\Addons\CurrencySwitcher\ServiceProvider as CurrencySwitcher; |
| 6 | use Give\TestData\Addons\FeeRecovery\ServiceProvider as FeeRecovery; |
| 7 | use Give\TestData\Addons\Funds\ServiceProvider as Funds; |
| 8 | use Give\TestData\Addons\ManualDonations\ServiceProvider as ManualDonations; |
| 9 | use Give\TestData\Addons\RecurringDonations\ServiceProvider as RecurringDonations; |
| 10 | |
| 11 | /** |
| 12 | * Class Addons |
| 13 | * @package Give\TestData\Helpers |
| 14 | */ |
| 15 | class Addons |
| 16 | { |
| 17 | /** |
| 18 | * Get add-ons |
| 19 | * |
| 20 | * @since 1.0.0 |
| 21 | * @return array[] |
| 22 | */ |
| 23 | public static function getAddons() |
| 24 | { |
| 25 | return [ |
| 26 | [ |
| 27 | 'isActive' => defined('GIVE_FUNDS_VERSION'), |
| 28 | 'serviceProvider' => Funds::class, |
| 29 | ], |
| 30 | [ |
| 31 | 'isActive' => defined('GIVE_CURRENCY_SWITCHER_VERSION'), |
| 32 | 'serviceProvider' => CurrencySwitcher::class, |
| 33 | ], |
| 34 | [ |
| 35 | 'isActive' => defined('GIVE_RECURRING_VERSION'), |
| 36 | 'serviceProvider' => RecurringDonations::class, |
| 37 | ], |
| 38 | [ |
| 39 | 'isActive' => defined('GIVE_FEE_RECOVERY_VERSION'), |
| 40 | 'serviceProvider' => FeeRecovery::class, |
| 41 | ], |
| 42 | [ |
| 43 | 'isActive' => defined('GIVE_MD_VERSION'), |
| 44 | 'serviceProvider' => ManualDonations::class, |
| 45 | ], |
| 46 | [ |
| 47 | 'isActive' => defined('GIVE_FUNDS_ADDON_VERSION'), |
| 48 | 'serviceProvider' => Funds::class, |
| 49 | ], |
| 50 | ]; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Get active add-ons |
| 55 | * @since 1.0.0 |
| 56 | * @return array[] |
| 57 | */ |
| 58 | public static function getActiveAddons() |
| 59 | { |
| 60 | return array_filter( |
| 61 | self::getAddons(), |
| 62 | function ($addon) { |
| 63 | return $addon['isActive']; |
| 64 | } |
| 65 | ); |
| 66 | } |
| 67 | } |
| 68 |