コード例 #1
0
ファイル: Route.php プロジェクト: delboy1978uk/bone
 /**
  * checks t' see if th' uri matches the regex routes
  *
  * @param $uri
  * @return bool
  */
 public function checkRoute($uri)
 {
     foreach ($this->strings as $expression) {
         // check if it matches the pattern
         $this->regex->setPattern($expression);
         if ($this->regex->getMatches($uri)) {
             $this->matched_uri_parts = explode('/', $uri);
             return true;
         }
     }
     return false;
 }
コード例 #2
0
ファイル: BoneRegexTest.php プロジェクト: delboy1978uk/bone
 public function testGetMatches()
 {
     $regex = new Regex('^\\/(?<controller>[^\\/]+)\\/(?<action>[^\\/]+)\\/(?<varvalpairs>(?:[^\\/]+\\/[^\\/]+\\/?)*)');
     $matches = $regex->getMatches('/controller/action/param/value/next-param/next-value') ? true : false;
     $this->assertTrue($matches);
 }
コード例 #3
0
ファイル: Router.php プロジェクト: delboy1978uk/bone
 private function regexMatch($regex_string)
 {
     $regex = new Regex($regex_string);
     return $regex->getMatches($this->uri);
 }