Symfony\Component\HttpFoundation\RequestMatcher::matchMethod PHP Method

matchMethod() public method

Adds a check for the HTTP method.
public matchMethod ( $method )
    public function matchMethod($method)
    {
        $this->methods = array_map(
            function ($m)
            {
                return strtolower($m);
            },
            is_array($method) ? $method : array($method)
        );
    }

Usage Example

 public function testPath()
 {
     $matcher = new RequestMatcher();
     $matcher->matchPath('#^/admin#');
     $request = Request::create('/admin/foo');
     $this->assertTrue($matcher->matches($request));
     $matcher->matchMethod('#^/blog#i');
     $this->assertFalse($matcher->matches($request));
 }
All Usage Examples Of Symfony\Component\HttpFoundation\RequestMatcher::matchMethod