Webiny\Component\Bootstrap\Environment::getCurrentEnvironmentName PHP Méthode

getCurrentEnvironmentName() public méthode

Get the name of the current loaded environment.
public getCurrentEnvironmentName ( ) : string
Résultat string
    public function getCurrentEnvironmentName()
    {
        if (!empty($this->currentEnvironmentName)) {
            return $this->currentEnvironmentName;
        }
        // get current environments
        $environments = $this->applicationConfig->get('Application.Environments', false);
        if ($environments) {
            // get current url
            $currentUrl = $this->str($this->httpRequest()->getCurrentUrl());
            // loop over all registered environments in the config, and try to match the current based on the domain
            foreach ($environments as $eName => $e) {
                if ($currentUrl->contains($e->Domain)) {
                    $this->currentEnvironmentName = $eName;
                }
            }
        }
        if (empty($this->currentEnvironmentName)) {
            $this->currentEnvironmentName = 'Production';
        }
        return $this->currentEnvironmentName;
    }