WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\Domain\Services

FeatureGating::load_environment() public WC 1.0

Set correct environment.

{} It's a method of the class: FeatureGating{}

No Hooks.

Return

null. Nothing.

Usage

$FeatureGating = new FeatureGating();
$FeatureGating->load_environment();

Code of FeatureGating::load_environment() WC 5.9.0

public function load_environment() {
	if ( 'unset' === $this->environment ) {
		if ( file_exists( __DIR__ . '/../../../blocks.ini' ) ) {
			$allowed_environments = [ self::PRODUCTION_ENVIRONMENT, self::DEVELOPMENT_ENVIRONMENT, self::TEST_ENVIRONMENT ];
			$woo_options          = parse_ini_file( __DIR__ . '/../../../blocks.ini' );
			$this->environment    = is_array( $woo_options ) && in_array( $woo_options['woocommerce_blocks_env'], $allowed_environments, true ) ? $woo_options['woocommerce_blocks_env'] : self::PRODUCTION_ENVIRONMENT;
		} else {
			$this->environment = self::PRODUCTION_ENVIRONMENT;
		}
	}
}