示例#1
0
文件: Uri.php 项目: schpill/thin
 /**
  * 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());
 }
示例#2
0
文件: Request.php 项目: schpill/thin
 /**
  * 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;
             }
         }
     }
 }