Retourne la clé de l'environnement ou une chaine vide si la machine n'est pas reconnue.

@return string
763792
public function getEnvironment()
    {
        if (!empty($this->environnement)) {
            $host      = gethostname();
            $authority = $this->request->getUri()->getAuthority();

            foreach ($this->environnement as $key => $env) {
                if (in_array($host, $env) || in_array($authority, $env)) {
                    return $key;
                }
            }
        }

        return '';
    }
1104562
public function previous()
    {
        $referrer = $this->request->headers->get('referer');

        $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession();

        return $url ?: $this->to('/');
    }
1049991
public function getIsCli()
    {
        if ($this->_isCli === null) {
            $this->_isCli = $this->getSapiName() === 'cli';
        }

        return $this->_isCli;
    }
680030
public function getEnvironment()
    {
        if ($this->environment === null) {
            $this->setEnvironment($this->getFact(Model\NodeInterface::ENVIRONMENT_FACT));
        }
        return $this->environment;
    }
845582
public function autoStop():string
    {
        $src = '';
        $this->status === self::STATUS_IN_CELL      && $src .= $this->endCell();
        $this->status === self::STATUS_IN_ROW       && $src .= $this->endRow();
        $this->status === self::STATUS_IN_CONTAINER && $src .= $this->endContainer($this->autoContainer);
        $this->autoCols = self::DEFAULT_COLS;
        $this->autoFluid = self::DEFAULT_FLUID;
        $this->autoCurrentCol = 0;
        $this->autoStarted = false;
        return $src;
    }
867450
public function getHome()
    {
        $home = null;

        if (!empty(getenv('HOME'))) {
            // Try the environmental variables.
            $home = getenv('HOME');
        } elseif (!empty($_SERVER['HOME'])) {
            // If not in the environment variables, check the superglobal $_SERVER as
            // a last resort.
            $home = $_SERVER['HOME'];
        } elseif (!empty(getenv('HOMEDRIVE')) && !empty(getenv('HOMEPATH'))) {
            // If the 'HOME' environmental variable wasn't found, we may be on
            // Windows.
            $home = getenv('HOMEDRIVE') . getenv('HOMEPATH');
        } elseif (!empty($_SERVER['HOMEDRIVE']) && !empty($_SERVER['HOMEPATH'])) {
            $home = $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH'];
        }

        if ($home === null) {
            throw new UnexpectedValueException('Could not locate home directory.');
        }

        return rtrim($home, '\\/');
    }
1061040
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;
    }
469239
public function promptForDeletion()
    {
        $cli = $this->climate();

        if (is_string($this->action)) {
            $opts = [ 'y', 'n', 'r', 'q', '?' ];
            $help = [
                '[y]es    — delete the attachment',
                '[n]o     — don’t delete the attachment',
                '[r]epeat — apply previous choice to remaining attachments',
                '[q]uit   — exit immediately (does not undo previous actions)',
            ];
        } else {
            $opts = [ 'y', 'a', 'n', 's', 'q', '?' ];
            $help = [
                '[y]es  — delete this attachment',
                '[a]ll  — delete all attachments',
                '[n]o   — don’t delete this attachment',
                '[s]kip — don’t delete attachments',
                '[q]uit — exit immediately (does not undo previous actions)',
            ];
        }

        $input = $cli->input($this->indent.'Delete attachment');
        $input->accept($opts, true);

        $value = $input->prompt();
        switch ($value) {
            case '?':
                $cli->br();
                $cli->out($this->indent.implode("\n".$this->indent, $help));
                $cli->br();
                return $this->promptForDeletion();

            case 'q':
                exit;

            case 'r':
                $this->repeat = -1;
                return ($this->action === 'y');

            case 's':
                $this->repeat = -1;
                $this->action = 'n';
                return false;

            case 'a':
                $this->repeat = -1;
                $this->action = 'y';
                return true;

            case 'n':
                $this->repeat = 0;
                $this->action = 'n';
                return false;

            case 'y':
            default:
                $this->repeat = 0;
                $this->action = 'y';
                return true;
        }
    }
597363
public function get() 
	{
		$sWhere = '';

		if (count($this->_aElement) > 0) {

			foreach ($this->_aElement as $aElement) {

				if ($aElement[1] instanceof \Attila\Orm\Where) {

					$sWhere .= ' '.$aElement[0].' ('.substr($aElement[1]->get(), 4).')';
				}
				elseif ($aElement[2] == 'SOUNDEX') {

					$sWhere .= ' '.$aElement[0].' SOUNDEX('.$aElement[1].') LIKE CONCAT(\'%\', TRIM(TRAILING \'0\' FROM  SOUNDEX(\''.$aElement[3].'\')), \'%\')';
				}
				else if (is_string($aElement[3]) && ($aElement[3] == 'NOW()' || $aElement[3] == 'CURDATE()')) {

					$sWhere .= ' '.$aElement[0].' '.$aElement[1].' '.$aElement[2]." ".$aElement[3]."";
				}
				else if (is_string($aElement[3]) && preg_match('/^\|(.*?)\|$/', $aElement[3], $aMatch)) {

					$sWhere .= ' '.$aElement[0].' '.$aElement[1].' '.$aElement[2]." ".$aMatch[1];
				}
				else if (is_string($aElement[3])) {

					$sWhere .= ' '.$aElement[0].' '.$aElement[1].' '.$aElement[2]." '".str_replace("'", "\'", $aElement[3])."'";
				}
				elseif (is_int($aElement[3]) || is_float($aElement[3])) {

					$sWhere .= ' '.$aElement[0].' '.$aElement[1].' '.$aElement[2].' '.$aElement[3];
				}
				elseif (is_array($aElement[3]) && $aElement[2] == 'IN') {

					$sWhere .= ' '.$aElement[0].' '.$aElement[1].' '.$aElement[2]." (".implode(',', $aElement[3]).")";
				}
			}
		}

		return $sWhere;
	}
989046
protected function getCurrentDirective()
    {
        if (!$this->directive) {
            $this->getEnvironment()->getErrorManager()->error('Asking for current directive, but there is not');
        }

        $name = $this->directive['name'];
        if (isset($this->directives[$name])) {
            return $this->directives[$name];
        } else {
            $message = 'Unknown directive: '.$name;
            $message .= ' in '.$this->getFilename().' line '.$this->getCurrentLine();
            $this->getEnvironment()->getErrorManager()->error($message);
            return null;
        }
    }
398877
public function getStubBannerFromFile()
    {
        if (null !== ($path = $this->getStubBannerPath())) {
            $path = $this->getBasePath() . DIRECTORY_SEPARATOR . $path;

            if (false === ($contents = @file_get_contents($path))) {
                $errors = error_get_last();
                if ($errors === null) {
                    $errors = array('message' => 'failed to get contents of \''.$path.'\'');
                }

                throw new RuntimeException($errors['message']);
            }

            return $contents;
        }

        return null;
    }
395619
public static function getInstance()
    {
        // Il y a visiblement un soucis sur php7, lorsqu'on accede à
        // static::$instance, la variable est globale alors qu'elle devrait dépendre du context d'où elle est appelée
        $name = get_called_class();
        if (!array_key_exists($name, self::$instance)) {
            self::$instance[$name] = new static();
        }
        return self::$instance[$name];
    }
1068007
protected function discoverSystemEnvironment()
    {
        $env = [];
        $output = shell_exec('env');
        if ($output) {
            $lines = explode("\n", $output);
            foreach ($lines as $line) {
                $values = explode('=', $line);
                if (!empty($values[0]) && !empty($values[1])) {
                    $env[$values[0]] = $values[1];
                }
            }
        }
        return $env;
    }
746101
public function getSearchArea()
    {
        if ($this->current()->path->getSegment(3) === 'occasions') {
            return 'toute la france';
        }

        if ($this->current()->path->getSegment(3) === 'bonnes_affaires') {
            return 'regions voisines';
        }

        return $this->current()->path->getSegment(2);
    }
834178
private function getEnv()
    {
        foreach (['CONVERT', 'PYTHON', 'AUDIO_BITRATE', 'STREAM'] as $var) {
            $env = getenv($var);
            if ($env) {
                $prop = lcfirst(str_replace('_', '', ucwords(strtolower($var), '_')));
                $this->$prop = $env;
            }
        }
    }
1053669
private function getResumenPeriodo()
    {
        $ResumenPeriodo = [
            'TotFolAnulado' => false,
            'TotGuiaAnulada' => false,
            'TotGuiaVenta' => 0,
            'TotMntGuiaVta' => 0,
            'TotTraslado' => false,
        ];
        foreach ($this->detalles as &$d) {
            // se contabiliza si la guía está anulada
            if ($d['Anulado']==1 or $d['Anulado']==2) {
                if ($d['Anulado']==1) {
                    $ResumenPeriodo['TotFolAnulado'] = (int)$ResumenPeriodo['TotFolAnulado'] + 1;
                } else {
                    $ResumenPeriodo['TotGuiaAnulada'] = (int)$ResumenPeriodo['TotGuiaAnulada'] + 1;
                }
            }
            // si no está anulado
            else {
                // si es de venta
                if ($d['TpoOper']==1) {
                    $ResumenPeriodo['TotGuiaVenta'] = (int)$ResumenPeriodo['TotGuiaVenta'] + 1;
                    $ResumenPeriodo['TotMntGuiaVta'] = (int)$ResumenPeriodo['TotMntGuiaVta'] + $d['MntTotal'];
                }
                // si no es de venta
                else {
                    if ($ResumenPeriodo['TotTraslado']===false) {
                        $ResumenPeriodo['TotTraslado'] = [];
                    }
                    if (!isset($ResumenPeriodo['TotTraslado'][$d['TpoOper']])) {
                        $ResumenPeriodo['TotTraslado'][$d['TpoOper']] = [
                            'TpoTraslado' => $d['TpoOper'],
                            'CantGuia' => 0,
                            'MntGuia' => 0,
                        ];
                    }
                    $ResumenPeriodo['TotTraslado'][$d['TpoOper']]['CantGuia']++;
                    $ResumenPeriodo['TotTraslado'][$d['TpoOper']]['MntGuia'] += $d['MntTotal'];
                }
            }
        }
        return $ResumenPeriodo;
    }
543518
public function getCurrentRemote()
    {
        /** @var $result CallResult */
        $result = $this->getGit()->{'remote'}($this->getRepositoryPath(), array(
             '-v'
        ));
        $result->assertSuccess(sprintf('Cannot remote "%s"', $this->getRepositoryPath()));

        $tmp = $result->getStdOut();

        preg_match_all('/([a-z]*)\h(.*)\h\((.*)\)/', $tmp, $matches);

        $retVar = array();
        foreach($matches[0] as $key => $value)
            $retVar[$matches[1][$key]][$matches[3][$key]] = $matches[2][$key];

        return $retVar;
    }