Skip to content

Instantly share code, notes, and snippets.

@ismail1432
Last active March 6, 2023 16:37
Show Gist options
  • Select an option

  • Save ismail1432/560c07c38d0d589e21b5eefd29034ab7 to your computer and use it in GitHub Desktop.

Select an option

Save ismail1432/560c07c38d0d589e21b5eefd29034ab7 to your computer and use it in GitHub Desktop.

Revisions

  1. ismail1432 revised this gist Mar 6, 2023. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions FeatureFlagEnum.php
    Original file line number Diff line number Diff line change
    @@ -8,30 +8,30 @@ public static function names()
    return array_column(self::cases(), 'name');
    }
    }

    // feature flag to resolve in a database
    enum DatabaseStorageFeatureFlagEnum
    {
    use FeatureFlagEnumTrait;

    case fake_payment;
    case new_checkout_api;
    }

    // feature flag to resolve with A/B testing
    enum ABTestingFeatureFlagEnum
    {
    use FeatureFlagEnumTrait;

    case pay_with_paypal;
    }

    // feature flag to resolve with Symfony parameters
    enum ParameterFeatureFlagEnum
    {
    use FeatureFlagEnumTrait;

    case use_stripe;
    case product_v2;
    }

    // feature flag to resolve with a period
    enum PeriodFeatureFlagEnum
    {
    use FeatureFlagEnumTrait;
  2. ismail1432 created this gist Mar 6, 2023.
    40 changes: 40 additions & 0 deletions FeatureFlagEnum.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    <?php
    namespace App\FeatureFlag\FeatureFlagEnum;

    trait FeatureFlagEnumTrait
    {
    public static function names()
    {
    return array_column(self::cases(), 'name');
    }
    }

    enum DatabaseStorageFeatureFlagEnum
    {
    use FeatureFlagEnumTrait;

    case fake_payment;
    case new_checkout_api;
    }

    enum ABTestingFeatureFlagEnum
    {
    use FeatureFlagEnumTrait;

    case pay_with_paypal;
    }

    enum ParameterFeatureFlagEnum
    {
    use FeatureFlagEnumTrait;

    case use_stripe;
    case product_v2;
    }

    enum PeriodFeatureFlagEnum
    {
    use FeatureFlagEnumTrait;

    case maintenance;
    }