Symfony\Component\HttpFoundation\Request::isMethodIdempotent PHP Method

isMethodIdempotent() public method

Checks whether or not the method is idempotent.
public isMethodIdempotent ( ) : boolean
return boolean
    public function isMethodIdempotent()
    {
        return in_array($this->getMethod(), array('HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE'));
    }

Usage Example

Esempio n. 1
0
 /**
  * @dataProvider methodIdempotentProvider
  */
 public function testMethodIdempotent($method, $idempotent)
 {
     $request = new Request();
     $request->setMethod($method);
     $this->assertEquals($idempotent, $request->isMethodIdempotent());
 }