コード例 #1
0
ファイル: Router.php プロジェクト: whereo/framework
 protected function parseRoute($route, $match)
 {
     $content = substr($match[0], 1, -1);
     $replacement = 'any';
     if (Str::contains($content, ':')) {
         list($variable, $pattern) = explode(':', $content);
         $this->setAttribute($variable, $pattern, $match[1]);
         $replacement = $pattern;
     } else {
         $this->setAttribute($content, 'any', $match[1]);
     }
     $search = sprintf('/{\\%s}/', $content);
     $replace = '(' . $this->patterns[$replacement] . ')';
     $route = preg_replace($search, $replace, $route);
     return $route;
 }
コード例 #2
0
ファイル: Session.php プロジェクト: whereo/framework
 public function regenerateToken()
 {
     $this->put('_token', Str::random(40));
 }