Browse Source

Merge pull request #866 from bwoester/more-request-method-checks

More request method checks
tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
4e2db366fc
  1. 27
      framework/yii/web/Request.php

27
framework/yii/web/Request.php

@ -137,6 +137,33 @@ class Request extends \yii\base\Request
} }
/** /**
* Returns whether this is a GET request.
* @return boolean whether this is a GET request.
*/
public function getIsGet()
{
return $this->getMethod() === 'GET';
}
/**
* Returns whether this is an OPTIONS request.
* @return boolean whether this is a OPTIONS request.
*/
public function getIsOptions()
{
return $this->getMethod() === 'OPTIONS';
}
/**
* Returns whether this is a HEAD request.
* @return boolean whether this is a HEAD request.
*/
public function getIsHead()
{
return $this->getMethod() === 'HEAD';
}
/**
* Returns whether this is a POST request. * Returns whether this is a POST request.
* @return boolean whether this is a POST request. * @return boolean whether this is a POST request.
*/ */

Loading…
Cancel
Save