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