Automattic\WooCommerce\Blocks\Domain\Services

FeatureGating::load_environment()publicWC 1.0

Set correct environment.

Метод класса: FeatureGating{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

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

Код FeatureGating::load_environment() WC 9.1.2

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;
		}
	}
}