public function setMethod($method = '')
    {
        if (mb_strlen($method) == 0) {
            $this->debug->debug(__FUNCTION__, 'Set Default Method = GET if $method is does not exist');
            $method = 'GET';
        } else {
            $method       = strtoupper($method);
            $validMethods = [
                'GET',
                'HEAD',
                'PUT',
                'POST',
                'DELETE'
            ];
            if (!in_array($method, $validMethods)) {
                $message = "Error: " . __CLASS__ . ": The requested method (${method}) is not valid here";
                $this->debug->error(__FUNCTION__, $message);

                return $message;
            }
        }
        $this->method = $method;

        return $this;
    }
public function setMethod($method = '')
    {
        if (mb_strlen($method) == 0) {
            $this->debug->debug(__FUNCTION__, 'Set Default Method = GET if $method is does not exist');
            $method = 'GET';
        } else {
            $method       = strtoupper($method);
            $validMethods = [
                'GET',
                'HEAD',
                'PUT',
                'POST',
                'DELETE'
            ];
            if (!in_array($method, $validMethods)) {
                $message = "Error: " . __CLASS__ . ": The requested method (${method}) is not valid here";
                $this->debug->error(__FUNCTION__, $message);

                return $message;
            }
        }
        $this->method = $method;

        return $this;
    }
public function setMethod ( $ method = '' ) { if ( mb_strlen ( $ method ) == 0 ) { $ this -> debug -> debug ( __FUNCTION__ , 'Set Default Method = GET if $method is does not exist' ) ; $ method = 'GET' ; } else { $ method = strtoupper ( $ method ) ; $ validMethods = [ 'GET' , 'HEAD' , 'PUT' , 'POST' , 'DELETE' ] ; if ( ! in_array ( $ method , $ validMethods ) ) { $ message = "Error: " . __CLASS__ . ": The requested method (${method}) is not valid here" ; $ this -> debug -> error ( __FUNCTION__ , $ message ) ; return $ message ; } } $ this -> method = $ method ; return $ this ; }
Set the HTTP method
GET, HEAD, PUT, POST are valid

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 10/7/18 02:15

@param string $method Method to Request GET, HEAD, PUT, POST are valid

@return $this|string Method
Set the HTTP method GET HEAD PUT POST are valid