Enable framework components
@param string $env Current environment
@throws Server500
176957
public static function enableComponents(string $env)
    {
        $base = realpath(__DIR__ . "/../../../../../../")."/";
        $f = json_decode(file_get_contents($base."elements/config_files/core/framework.config.json"));
        if (in_array($env, array("dev", "prod"))) {
            if ("dev" === $env) {
                TaskBar::switchStatus(((true  === $f->taskbar_dev)? "on" : "off"));
            } elseif ("prod" === $env) {
                TaskBar::switchStatus(((true  === $f->taskbar_prod)? "on" : "off"));
            }
            if (property_exists($f, "debug") &&
                property_exists($f->debug, $env) && true === $f->debug->$env) {
                Debug::enabled();
            } else {
                Debug::disabled();
            }
        }
    }
1287697
public static function createFromEnv(array $env)
    {
        // cache
        if (isset($env['__request_object'])) {
            return $env['__request_object'];
        }

        if (isset($env['PATH_INFO'])) {
            $path = $env['PATH_INFO'];
        } elseif (isset($env['REQUEST_URI'])) {
            $path = $env['REQUEST_URI'];
        } elseif (isset($env['_SERVER']['PATH_INFO'])) {
            $path = $env['_SERVER']['PATH_INFO'];
        } elseif (isset($env['_SERVER']['REQUEST_URI'])) {
            $path = $env['_SERVER']['REQUEST_URI'];
        } else {
            // XXX: check path or throw exception
            $path = '/';
        }

        $requestMethod = 'GET';
        if (isset($env['REQUEST_METHOD'])) {
            $requestMethod = $env['REQUEST_METHOD'];
        } else if (isset($env['_SERVER']['REQUEST_METHOD'])) { // compatibility for superglobal
            $requestMethod = $env['_SERVER']['REQUEST_METHOD'];
        }

        // create request object with request method and path,
        // we can assign other parameters later.
        $request = new self($requestMethod, $path);
        if (function_exists('getallheaders')) {
            $request->headers = getallheaders();
        } else {
            // TODO: filter array keys by their prefix, consider adding an extension function for this.
            $request->headers = self::createHeadersFromServerGlobal($env);
        }

        if (isset($env['_SERVER'])) {
            $request->serverParameters = $env['_SERVER'];
        } else {
            $request->serverParameters = $env;
        }
        $request->parameters = $env['_REQUEST'];
        $request->queryParameters = $env['_GET'];
        $request->bodyParameters = $env['_POST'];
        $request->cookieParameters = $env['_COOKIE'];
        $request->sessionParameters = $env['_SESSION'];

        return $env['__request_object'] = $request;
    }
680826
public function envHalt()
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $this->engineInstance()->suspend();
        $this->executeCommandHook(__FUNCTION__, 'after');
    }
1062582
public static function setEnvironment($env = self::ENV_STAGE)
  {
    $prefix = '';
    if($env === self::ENV_STAGE)
    {
      $prefix = 's';
    }

    static::$apiHost = $prefix . 'api.fortifi.io';
  }
461984
private function setEnvironmentVariables(array $env)
    {
        foreach ($env as $name => $value) {
            putenv("$name=$value");

            $_ENV[$name] = $value;
            $_SERVER[$name] = $value;
        }
    }
1111458
public function getlogActivity(string $env):Renderer
    {
        if (!in_array($env, array("dev", "prod"))) {
            throw new Server500(new \ArrayObject(array("explain" => "Bad environment name $env",
                "solution" => "Environment must be 'dev' or 'prod' ")));
        }
        $last = array_values((AbstractServer::getLogs($env)));
        $lastn = array();
        $request = $this->get('request');
        $loglastpos =  $request->get('pos');
        $orderby = 29;
        if ($loglastpos == null) {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "results" => "Cannot get the last position")));
        }
        $loglastpos = (int)$loglastpos;
        $max = $loglastpos + $orderby;
        for ($i = $loglastpos; $i <= $max; $i++) {
            if (!isset($last[$i])) {
                continue;
            }
            $one = $last[$i];
            $last["env"] = strtoupper($env);
            $last[$i]['time'] = strtotime($last[$i]['time']);
            $last[$i]['log_url'] = $this->generateRoute(
                "iumio_manager_logs_manager_get_one",
                array("uidie" => $one['uidie'], "env" => $env)
            );
            array_push($lastn, $last[$i]);
        }
        return ((new Renderer())->jsonRenderer(array("code" => 200, "results" => $lastn)));
    }
416969
public function setEnvironment($env)
    {
        if ($this->started) {
            throw new LogicException('Puli is already started');
        }

        Assert::oneOf($env, Environment::all(), 'The environment must be one of: %2$s. Got: %s');

        $this->env = $env;
    }
635030
public static function setEnv(array $env = [])
    {
        self::$envIsSet = true;

        foreach ($env as $variable => $value) {
            self::setEnvironmentVariable($variable, $value);
        }
    }
290492
protected function setEnvironment(Application $app, ?string $env = null): void
    {
        $app->detectEnvironment(function () use ($env) {
            return $env ?: env('APP_ENV', 'production');
        });
    }
62761
public function setEnvironment($env)
    {
        Assert::oneOf($env, Environment::all(), 'The environment must be one of: %2$s. Got: %s');

        $this->env = $env;
    }
581539
private function compactEnv(Environment $env)
    {
        for ($envs = []; $env; $env = $env->parent) {
            $envs[] = $env;
        }

        return $envs;
    }
332247
public function environment($env = null)
    {
        if ($env !== null) {
            // Windows nodejs needs these environment variables.
            $winenv = $this->_getenv(array('SystemDrive', 'SystemRoot'));
            $this->_env = array_merge($winenv, $env);
            return $this;
        }
        return $this->_env;
    }
600099
public function clearActivity(string $env):Renderer
    {
        if (!in_array($env, array("dev", "prod"))) {
            throw new Server500(new \ArrayObject(array("explain" => "Bad environment name $env",
                "solution" => "Environment must be 'dev' or 'prod' ")));
        }
        Server::delete(FEnv::get("framework.logs").strtolower($env).".log", 'file');
        @Server::create(FEnv::get("framework.logs").strtolower($env).".log", 'file');

        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
919271
public function servers($site, $env)
    {
        $variables = array(
            'site' => $site,
            'env' => $env,
        );
        $request = $this->get(array('{+base_path}/sites/{site}/envs/{env}/servers.json', $variables));
        return new Response\Servers($request);
    }
388435
public function setEnv(?array $env)
    {
        $this->env = $env;

        $this->raw = array_merge($this->raw, ['Env' => $env]);

        return $this;
    }
539269
public function setEnv($env = null)
    {
        if (in_array($env, \WebServCo\Framework\Environment::getOptions())) {
            $this->env = $env;
        } else {
            $this->env = \WebServCo\Framework\Environment::ENV_DEV;
        }

        return true;
    }
401195
public function setEnvironments($env) {
    $envs = (explode('+', $env));
    while (!empty($envs)) {
      $_env = array_shift($envs);
      if (!$this->setEnvironment($_env)) {
        $msg = dt("Unable to locate an environment definition for '@env'.", ['@env' => $_env]);
        if (empty($envs)) {
          drush_log($msg, 'warning');
          return FALSE;
        }
        else {
          drush_log($msg, 'warning');
          if (!drush_confirm(dt("Do you want to process the other environments?"))) {
            return drush_user_abort(dt("Aborting."));
          }
        }
      }
    }

    return TRUE;
  }