REST_Controller::_detect_method PHP Метод

_detect_method() защищенный Метод

Get the HTTP request string e.g. get or post
protected _detect_method ( ) : string | null
Результат string | null Supported request method as a lowercase string; otherwise, NULL if not supported
    protected function _detect_method()
    {
        // Declare a variable to store the method
        $method = NULL;
        // Determine whether the 'enable_emulate_request' setting is enabled
        if ($this->config->item('enable_emulate_request') === TRUE) {
            $method = $this->input->post('_method');
            if ($method === NULL) {
                $method = $this->input->server('HTTP_X_HTTP_METHOD_OVERRIDE');
            }
            $method = strtolower($method);
        }
        if (empty($method)) {
            // Get the request method as a lowercase string
            $method = $this->input->method();
        }
        return in_array($method, $this->allowed_http_methods) && method_exists($this, '_parse_' . $method) ? $method : 'get';
    }