From 8b9514fd5f7659228c6c28819ec2e5e126f475c7 Mon Sep 17 00:00:00 2001 From: Evgeniy Tkachenko Date: Thu, 28 Jan 2016 23:15:10 +0300 Subject: [PATCH] Refactoring yii\web\Request::getMethod --- framework/web/Request.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/framework/web/Request.php b/framework/web/Request.php index 536909a..356fb14 100644 --- a/framework/web/Request.php +++ b/framework/web/Request.php @@ -231,11 +231,17 @@ class Request extends \yii\base\Request { if (isset($_POST[$this->methodParam])) { return strtoupper($_POST[$this->methodParam]); - } elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) { + } + + if (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) { return strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']); - } else { - return isset($_SERVER['REQUEST_METHOD']) ? strtoupper($_SERVER['REQUEST_METHOD']) : 'GET'; } + + if (isset($_SERVER['REQUEST_METHOD'])) { + return strtoupper($_SERVER['REQUEST_METHOD']); + } + + return 'GET'; } /**