Beispiel #1
0
 /**
  * Detect the application's current environment.
  *
  * @param  array|string|Callable  $environments
  *
  * @return string
  */
 public function detectEnvironment($environments)
 {
     $r = Request::getInstance();
     $pos = stripos($r->server->get('SCRIPT_NAME'), DISPATCHER_FILENAME);
     if ($pos > 0) {
         //we do this because in CLI circumstances (and some random ones) we would end up with index.ph instead of index.php
         $pos = $pos - 1;
     }
     $home = substr($r->server->get('SCRIPT_NAME'), 0, $pos);
     $this['app_relative_path'] = rtrim($home, '/');
     $args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null;
     $detector = new EnvironmentDetector();
     return $this->environment = $detector->detect($environments, $args);
 }
 /**
  * Detect the application's current environment.
  *
  * @param  array|string|Callable  $environments
  * @return string
  */
 public function detectEnvironment($environments)
 {
     $args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null;
     $detector = new EnvironmentDetector();
     return $this->environment = $detector->detect($environments, $args);
 }