Create a normalized tree of UploadedFile instances from the Environment.

Returns a normalized tree of UploadedFile instances or null if none are provided.

@param Environment $env The environment

@return array|null
190858
public static function createFromEnvironment(Environment $env)
    {
        if (is_array($env['slim.files']) && $env->has('slim.files')) {
            return $env['slim.files'];
        } elseif (! empty($_FILES)) {
            return static::parseUploadedFiles($_FILES);
        }

        return [];
    }
204853
public function load($environment = null)
    {
        foreach ($this->loader->load($environment) as $key => $value) {
            $_ENV[$key] = $value;

            $_SERVER[$key] = $value;

            putenv("{$key}={$value}");
        }
    }
639345
public static function loadPackages($env = 'dev', CoreConsole $console = null)
    {
        $console = $console ?: Ioc::getApplication();

        return (array) (new Structure())
            ->loadFile($console->get('path.etc') . '/app/console.php', 'php')
            ->loadFile($console->get('path.etc') . '/app/' . $env . '.php', 'php')
            ->get('packages');
    }
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;
    }
78581
public function get($key, $env = NULL)
    {
        if (!$env) {
            $env = self::$current_env;
        }

        return isset(self::$params[$env][$key]) ? self::$params[$env][$key] : NULL;
    }
202572
protected function getPantheonSiteEnv($env = '') {
    $site = getenv('TERMINUS_SITE');

    if (!$env) {
      $env = getenv('TERMINUS_ENV');
    }

    return join('.', [$site, $env]);
  }
654613
protected function parseEnv(
        array $envs,
        /*# string */ $path,
        /*# bool */ $overload
    )/*# : array */ {
        foreach ($envs as $key => $val) {
            // source another env file
            if ($this->source_marker === $val) {
                $src = $this->expandPath($this->deReference($key), $path);
                $this->load($src, $overload);

            // set env
            } else {
                $this->setEnv($key, $this->deReference($val), $overload);
            }
        }
        return $this;
    }
428421
private function normalizeSha(Environment $environment, $sha = null)
    {
        if ($environment->head_commit === null) {
            return null;
        }
        if ($sha === null) {
            return $environment->head_commit;
        }
        if (strpos($sha, 'HEAD') === 0) {
            $sha = $environment->head_commit . substr($sha, 4);
        }

        return $sha;
    }
507876
public function detectEnvironment($envs)
    {
        $args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null;

        return $this['env'] = (new EnvironmentDetector())->detect($envs, $args);
    }
439840
protected function buildEnvironmentVariables($env)
    {
        $variables = '';
        foreach ($env as $key => $value) {
            $variables .= $key.'='.$value.' ';
        }

        return trim($variables);
    }
653805
public function environment($site, $env)
    {
        $variables = array(
            'site' => $site,
            'env' => $env,
        );
        $request = $this->get(array('{+base_path}/sites/{site}/envs/{env}.json', $variables));
        return new Response\Environment($request);
    }
1004116
public function env($key, $value = null)
    {
        if ($value !== null) {
            $_ENV[$key] = $value;
            putenv($key . '=' . $value);
        }

        if (isset($_ENV[$key])) {
            return $_ENV[$key];
        }
        return false === getenv($key) ? null : getenv($key);
    }
141476
public static function loadEnvironment($env = null)
    {
        $env = $env ? $env : static::$env;

        foreach((array) static::$loadedPaths as $path){
            if(is_dir($path.DS.$env)){
                self::load($path.DS.$env);
            }
        }
    }
88491
public function loadConfigDir($dir, $env = null)
    {
        !$env && $env = $this->name;
        $config = $this->getFileConfig($dir . '/config.php');
        $envConfig = $this->getFileConfig($dir . '/config-' . $env . '.php');
        $config = array_replace_recursive($config, $envConfig);
        $this->wei->setConfig($config);
        return $this;
    }
329867
public function environmentDatabases($site, $env)
    {
        $variables = array(
            'site' => $site,
            'env' => $env,
        );
        $request = $this->get(array('{+base_path}/sites/{site}/envs/{env}/dbs.json', $variables));
        return new Response\Databases($request);
    }
956151
static function fromEnvironment(array $env = null): self {
    if (!is_array($env)) $env = $_ENV ?: $_SERVER;
    $config = new static;

    // Standard.
    $serviceName = $env['CI_NAME'] ?? '';
    if (mb_strlen($serviceName)) $config['service_name'] = $serviceName;

    if (isset($env['CI_BRANCH'])) $config['service_branch'] = $env['CI_BRANCH'];
    if (isset($env['CI_BUILD_NUMBER'])) $config['service_number'] = $env['CI_BUILD_NUMBER'];
    if (isset($env['CI_BUILD_URL'])) $config['service_build_url'] = $env['CI_BUILD_URL'];
    if (isset($env['CI_COMMIT'])) $config['commit_sha'] = $env['CI_COMMIT'];
    if (isset($env['CI_JOB_ID'])) $config['service_job_id'] = $env['CI_JOB_ID'];

    if (isset($env['CI_PULL_REQUEST']) && preg_match('/(\d+)$/', $env['CI_PULL_REQUEST'], $matches)) {
      if (count($matches) >= 2) $config['service_pull_request'] = $matches[1];
    }

    // Coveralls.
    if (isset($env['COVERALLS_REPO_TOKEN']) || isset($env['COVERALLS_TOKEN']))
      $config['repo_token'] = $env['COVERALLS_REPO_TOKEN'] ?? $env['COVERALLS_TOKEN'];

    if (isset($env['COVERALLS_COMMIT_SHA'])) $config['commit_sha'] = $env['COVERALLS_COMMIT_SHA'];
    if (isset($env['COVERALLS_PARALLEL'])) $config['parallel'] = $env['COVERALLS_PARALLEL'];
    if (isset($env['COVERALLS_RUN_AT'])) $config['run_at'] = $env['COVERALLS_RUN_AT'];
    if (isset($env['COVERALLS_SERVICE_BRANCH'])) $config['service_branch'] = $env['COVERALLS_SERVICE_BRANCH'];
    if (isset($env['COVERALLS_SERVICE_JOB_ID'])) $config['service_job_id'] = $env['COVERALLS_SERVICE_JOB_ID'];
    if (isset($env['COVERALLS_SERVICE_NAME'])) $config['service_name'] = $env['COVERALLS_SERVICE_NAME'];

    // Git.
    if (isset($env['GIT_AUTHOR_EMAIL'])) $config['git_author_email'] = $env['GIT_AUTHOR_EMAIL'];
    if (isset($env['GIT_AUTHOR_NAME'])) $config['git_author_name'] = $env['GIT_AUTHOR_NAME'];
    if (isset($env['GIT_BRANCH'])) $config['service_branch'] = $env['GIT_BRANCH'];
    if (isset($env['GIT_COMMITTER_EMAIL'])) $config['git_committer_email'] = $env['GIT_COMMITTER_EMAIL'];
    if (isset($env['GIT_COMMITTER_NAME'])) $config['git_committer_name'] = $env['GIT_COMMITTER_NAME'];
    if (isset($env['GIT_ID'])) $config['commit_sha'] = $env['GIT_ID'];
    if (isset($env['GIT_MESSAGE'])) $config['git_message'] = $env['GIT_MESSAGE'];

    // CI services.
    if (isset($env['TRAVIS'])) {
      $config->merge(TravisCI::getConfiguration($env));
      if (mb_strlen($serviceName) && $serviceName != 'travis-ci') $config['service_name'] = $serviceName;
    }
    else if (isset($env['APPVEYOR'])) $config->merge(AppVeyor::getConfiguration($env));
    else if (isset($env['CIRCLECI'])) $config->merge(CircleCI::getConfiguration($env));
    else if ($serviceName == 'codeship') $config->merge(Codeship::getConfiguration($env));
    else if (isset($env['GITLAB_CI'])) $config->merge(GitLabCI::getConfiguration($env));
    else if (isset($env['JENKINS_URL'])) $config->merge(Jenkins::getConfiguration($env));
    else if (isset($env['SEMAPHORE'])) $config->merge(Semaphore::getConfiguration($env));
    else if (isset($env['SURF_SHA1'])) $config->merge(Surf::getConfiguration($env));
    else if (isset($env['TDDIUM'])) $config->merge(SolanoCI::getConfiguration($env));
    else if (isset($env['WERCKER'])) $config->merge(Wercker::getConfiguration($env));

    return $config;
  }
1162313
function createEnvironment()
    {
        $env = new Environment;

        $loadPaths = $this->loadPaths ?: array();

        foreach ($loadPaths as $path) {
            $env->appendPath(dirname($this->filename) . "/" . $path);
        }

        if (!$this->debug) {
            if ($jsCompressor = $this->jsCompressor) {
                $env->setJsCompressor($jsCompressor);
            }

            if ($cssCompressor = $this->cssCompressor) {
                $env->setCssCompressor($cssCompressor);
            }
        }

        return $env;
    }