Container.php
2 years ago
FeatureProviderInterface.php
4 years ago
FeatureServiceProvider.php
4 years ago
Resolver.php
3 years ago
ServiceProvider.php
3 years ago
FeatureProviderInterface.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * The API provided by a Service Provider that completely provides a feature. |
| 5 | * |
| 6 | * @package WPStaging\Framework\DI |
| 7 | */ |
| 8 | |
| 9 | namespace WPStaging\Framework\DI; |
| 10 | |
| 11 | /** |
| 12 | * Interface FeatureProviderInterface |
| 13 | * |
| 14 | * @package WPStaging\Framework\DI |
| 15 | */ |
| 16 | interface FeatureProviderInterface |
| 17 | { |
| 18 | /** |
| 19 | * Returns whether the feature provided by the provider is enabled or not. |
| 20 | * |
| 21 | * The check will happen on the feature provider trigger by checking if |
| 22 | * the feature is available (the trigger constant is defined and true) and, if so, |
| 23 | * if the environment var by the same name is not set to falsy value. |
| 24 | * |
| 25 | * @return bool Whether the feature provided is enabled or not. |
| 26 | */ |
| 27 | public static function isEnabledInProduction(); |
| 28 | |
| 29 | /** |
| 30 | * Returns the constant, or environment variables, that will trigger the feature provider |
| 31 | * registration when set to truthy values. |
| 32 | * |
| 33 | * A Feature Provider MUST use the same name for both the constant that will enable it if |
| 34 | * defined AND true and for the environment variable that will disable it if set and falsy. |
| 35 | * |
| 36 | * @return string The name of the constant, or environment variable, that will trigger the |
| 37 | * feature provider registration when set to truthy values. |
| 38 | */ |
| 39 | public static function getFeatureTrigger(); |
| 40 | |
| 41 | /** |
| 42 | * A Feature Provider MUST clearly indicate whether it did register or not. |
| 43 | * |
| 44 | * A Feature Provider might not register as it's not enabled or because its |
| 45 | * requirements are not satisfied. |
| 46 | * |
| 47 | * @return bool Whether the Feature Provider did register, as enabled, or not. |
| 48 | */ |
| 49 | public function register(); |
| 50 | } |
| 51 |