Exemple #1
0
 /**
  * Determine if the current URI matches a given pattern.
  *
  * @param  string  $pattern
  * @return bool
  */
 public static function is($pattern)
 {
     return Inflector::is($pattern, static::current());
 }
Exemple #2
0
 /**
  * Detect the current environment from an environment configuration.
  *
  * @param  array        $environments
  * @param  string       $uri
  * @return string|null
  */
 public static function detectEnv(array $environments, $uri)
 {
     foreach ($environments as $environment => $patterns) {
         // Essentially we just want to loop through each environment pattern
         // and determine if the current URI matches the pattern and if so
         // we will simply return the environment for that URI pattern.
         foreach ($patterns as $pattern) {
             if (Inflector::is($pattern, $uri) or $pattern == gethostname()) {
                 return $environment;
             }
         }
     }
 }