public function setMethod($method) {
        $method = (int) $method;
        switch ($this->method) {
            case self::METHOD_AUTO:
            case self::METHOD_GET:
            case self::METHOD_POST:
                $this->method = $method;
                break;
            default:
                throw new InvalidArgumentException();
        }
    }