@param UninitializedSymfonyExtensionEnvironment $uninitializedEnvironment

@throws EnvironmentIsolationException
960592
public function isolateEnvironment(Environment $uninitializedEnvironment, $testSubject = null): Environment
    {
        $this->assertEnvironmentCanBeIsolated($uninitializedEnvironment, $testSubject);

        $environment = new InitializedSymfonyExtensionEnvironment($uninitializedEnvironment->getSuite());

        foreach ($uninitializedEnvironment->getServices() as $serviceId) {
            /** @var Context $context */
            $context = $this->getContainer()->get($serviceId);

            $this->initializeContext($context);

            $environment->registerContext($context);
        }

        /** @var InitializedContextEnvironment $delegatedEnvironment */
        $delegatedEnvironment = $this->decoratedEnvironmentHandler->isolateEnvironment($uninitializedEnvironment->getDelegatedEnvironment());

        foreach ($delegatedEnvironment->getContexts() as $context) {
            $environment->registerContext($context);
        }

        return $environment;
    }
1306751
private function registerInitializers(array $initializers)
    {
        foreach ($initializers as $initializer) {
            if (is_string($initializer) && class_exists($initializer)) {
                $initializer = new $initializer();
                if (! ($initializer instanceof InitializerInterface)) {
                    throw InvalidArgumentException::fromInvalidInitializer($initializer);
                }
            }
            if (is_callable($initializer)) {
                $this->initializers[] = $initializer;
            } else {
                throw InvalidArgumentException::fromInvalidInitializer($initializer);
            }
        }
    }
1283417
public void init(ResourceBundle resourceBundle, String strResourceName, boolean bReturnKeyOnMissing)
    {
        m_resourceBundle = resourceBundle;
        m_strResourceName = strResourceName;
        m_bReturnKeyOnMissing = bReturnKeyOnMissing;
    }
16688
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        // Determine app and environment from path.
        $cwd = getcwd();
        $config = $this->getApplication()->getTerra()->getConfig();

        foreach ($config->get('apps') as $app) {
            if (!isset($app['environments'])) {
              $app['environments'] = array();
            }
            foreach ($app['environments'] as $environment) {
                if (strpos($cwd, $environment['path']) === 0) {
                  
                    if ($input->hasArgument('app_name')) {
                      $input->setArgument('app_name', $app['name']);
                    }
                    
                    if ($input->hasArgument('environment_name')) {
                      $input->setArgument('environment_name', $environment['name']);
                    }

                    $environment_string = $app['name'] . ':' . $environment['name'];

                    $output->writeln("Using environment <question>$environment_string</question>");
                }
            }
        }
    }
1055016
public function setEnvironment($env = self::ENV_PRODUCTION)
    {
        if ($env != self::ENV_DEVELOPMENT && $env != self::ENV_PRODUCTION) {
            throw new RestException('Unknown environment "' . $env . '".');
        }

        $this->environment = $env;
    }
1156186
private static function validateEnvironment(string $specifiedEnvironment): void
    {
        if ('' === $specifiedEnvironment ||
            false === \in_array($specifiedEnvironment, self::LIST, true)
        ) {
            throw new \LogicException(
                \sprintf(
                    'Provided incorrect value of the environment: "%s". Allowable values: %s',
                    $specifiedEnvironment,
                    \implode(', ', \array_values(self::LIST))
                )
            );
        }
    }
575821
public function setInitializer(QueryInitializer $initial)
    {
        $this->initial = $initial;
        for ($i = 0; $i < $this->length(); ++$i) {
            if ($this->offsetExists($i)) {
                $this->offsetGet($i)->setInitializer($this->initial);
            }
        }
    }
222227
public function patch(
        EnvironmentInterface $environment
    ) {
        foreach ($this->patchers as $patcher) {
            $patcher->patch($environment);
        }
    }
1211893
public function populateController(EnvironmentInterface $environment)
    {
        // Already populated, get out then.
        if ($environment->getController()) {
            return;
        }

        $definition = $environment->getDataDefinition();

        // If we encounter an extended definition, that one may override.
        if (!$definition->hasDefinition(ExtendedDca::NAME)) {
            return;
        }

        if (!($class = $definition->getDefinition(ExtendedDca::NAME)->getControllerClass())) {
            return;
        }

        /** @var ControllerInterface $controller */
        $controller = (new \ReflectionClass($class))->newInstance();

        $controller->setEnvironment($environment);
        $environment->setController($controller);
    }
554898
public function initializeObject($initializationCause)
    {
        if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
            $this->rootNodeData = new NodeData('/', $this);
            $this->nodeDataRepository->add($this->rootNodeData);

            if ($this->owner instanceof UserInterface) {
                $this->setOwner($this->owner);
            }
        }
    }
632842
private function setProjectProfiles(EnvironmentInterface $environment)
    {
        $projectFs = $environment->getProjectFilesystem();
        if (!$projectFs->has(self::PROJECT_PHPCS)) {
            return;
        }

        $ideConfigFs = $environment->getIdeConfigFilesystem();

        $xml = simplexml_load_string(
            $ideConfigFs->read(self::INSPECTION_PROFILE)
        );

        $this->setProjectPhpCsProfile($xml);
        $ideConfigFs->put(self::INSPECTION_PROFILE, $xml->asXML());
    }
1224823
protected void initialize(ConfigurableEnvironment environment,
			ClassLoader classLoader) {
		new LoggingSystemProperties(environment).apply();
		LogFile logFile = LogFile.get(environment);
		if (logFile != null) {
			logFile.applyToSystemProperties();
		}
		initializeEarlyLoggingLevel(environment);
		initializeSystem(environment, this.loggingSystem, logFile);
		initializeFinalLoggingLevels(environment, this.loggingSystem);
		registerShutdownHookIfNecessary(environment, this.loggingSystem);
	}
9635
protected function initEnvironment(): void
    {
        $envFile = $this->getRootRelatedPath($this->getEnvFileName());

        $this->assertFileIsReadable($envFile);

        self::$envIsSet = (bool)(new Dotenv($this->getRootDirectory(), $this->getEnvFileName()))->load();
    }
1108398
public function enableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) {
		$name = $environment->getFullName();
		$command = $this->getCommand('maintenance:enable', 'web', $environment, null, $log);
		$command->run(function($type, $buffer) use($log) {
			$log->write($buffer);
		});
		if(!$command->isSuccessful()) {
			$this->extend('maintenanceEnableFailure', $environment, $log);
			throw new RuntimeException($command->getErrorOutput());
		}
		$log->write(sprintf('Maintenance page enabled on "%s"', $name));
	}
1245780
public static void setDefaultEnvironment(String environment) {
    System.setProperty("pelzer.environment", environment);
    Logging.getLogger(EnvironmentManager.class);
    PropertyManager.setDefaultEnvironment(environment);
  }
1216470
protected function initEnvironment()
    {
        $this->storedLocale = getenv("LANG");

        $this->log("Setting locale to " . $this->locale, Project::MSG_DEBUG);
        putenv("LANG=" . $this->locale);
        $ret = setlocale(LC_ALL, $this->locale);
        if ($ret === false) {
            $msg = "Could not set locale to " . $this->locale
                . ". You may need to use fully qualified name"
                . " (e.g. en_US instead of en).";
            throw new BuildException($msg);
        }

        $this->log("Binding domain '" . $this->domain . "' to " . $this->dir, Project::MSG_DEBUG);
        bindtextdomain($this->domain, $this->dir->getAbsolutePath());
        textdomain($this->domain);
    }
610155
public function bootstrap(Application $app)
    {
        if ($app->configurationIsCached()) {
            return;
        }

        $this->checkForSpecificEnvironmentFile($app);
        try {
            (new Dotenv($app->environmentPath(), $app->environmentFile()))->load();
        } catch (InvalidPathException $e) {
            //
        }
    }