Skip to content

Instantly share code, notes, and snippets.

@ismail1432
Last active March 6, 2023 16:37
Show Gist options
  • Save ismail1432/560c07c38d0d589e21b5eefd29034ab7 to your computer and use it in GitHub Desktop.
Save ismail1432/560c07c38d0d589e21b5eefd29034ab7 to your computer and use it in GitHub Desktop.
<?php
namespace App\FeatureFlag\FeatureFlagEnum;
trait FeatureFlagEnumTrait
{
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;
case maintenance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment