Create an Amp\Artax\Request object from the operation.

@return \Amp\Artax\Request
6053
public function createRequest() {
        $request = new \Amp\Artax\Request();
        $url = null;
        $request->setMethod('');



        //Parameters are parsed and set, lets prepare the request
        if ($url == null) {
            $url = "https://api.github.com";
        }
        $request->setUri($url);

        return $request;
    }
800728
public static function getRequest(): Request
    {
        $serverArr = $_SERVER;

        if ('cli' === PHP_SAPI) {
            // If we're running off the CLI, we're going to set some default
            // settings.
            $serverArr['REQUEST_URI'] = $_SERVER['REQUEST_URI'] ?? '/';
            $serverArr['REQUEST_METHOD'] = $_SERVER['REQUEST_METHOD'] ?? 'CLI';
        }

        $r = self::createFromServerArray($serverArr);
        $r->setBody(fopen('php://input', 'r'));
        $r->setPostData($_POST);

        return $r;
    }
42430
public function getRequest(): ?Request
    {
        if (!$this->hasRequest()) {
            $this->setRequest($this->getDefaultRequest());
        }
        return $this->request;
    }
639990
protected function newRequest()
    {
        $req = new \stdClass;
        $req->attrs = new \stdClass();
        $req->attrs->request = [];
        $req->attrs->get = [];
        $req->attrs->post = [];
        $req->attrs->cookie = [];
        $req->attrs->server = [];
        $req->attrs->files = [];
        $req->attrs->session = null;
        $req->attrs->paramsDone = false;
        $req->attrs->inputDone = false;
        $req->attrs->input = new Input();
        $req->attrs->inputReaded = 0;
        $req->attrs->chunked = false;
        $req->upstream = $this;
        return $req;
    }
46616
function request()
    {
        if (!$this->request) {
            $request = new HttpRequest( new BuildHttpRequest );
            $this->request = $request;
        }

        return $this->request;
    }
353305
protected function buildCliRequest()
    {
        global $argv;
        
        $args = $argv;
        $params = array();
        $route = '';
        
        foreach ($args as $arg) {
            if ($arg === $_SERVER['PHP_SELF']) {
                continue;
            }
            
            if (strpos($arg, '-') === 0) {
                list($key, $value) = $this->parseArgument($arg);
                
                $params[$key] = $value;
            } else {
                if ($route !== '') {
                    $route .= ' ';
                }
                
                $route .= $arg;
            }
        }
        
        $base = $argv[0];
        
        $operatingSystem = $this->getOperatingSystem();
        
        return new CliRequest($route, $params, $base, 'en_US', $operatingSystem);
    }
114718
public function getRequest()
	{
	    $name = 'web.request';
	    if (!Ioc::has($name)) {
	        Ioc::setShared($name, function(){
	            return Request::createFromGlobals($_SERVER);
	        });
	    }
	    
	    return Ioc::get($name);
	}
552579
protected function buildRequest()
    {
        $request = new Request($this->helper());
        $request->setRouter($this->router());

        return $request;
    }
1216251
public function headRequest()
    {
        $operation = array(
            'API' => 'HeadBucket',
            'Method' => 'HEAD',
            'Uri' => '/<bucket-name>',
            'Headers' => array(
                'Host' => $this->properties['zone'] . '.' . $this->config->host,
            ),
            'Params' => array(
            ),
            'Elements' => array(
            ),
            'Properties' => $this->properties,
            'Body' => null
        );
        $this->headValidate($operation);
        $req = new Request($this->config, $operation);
        return $req;
    }
374929
public function getRequest()
    {
        $request = $this->container['request'];

        if ($request instanceof IlluminateRequest && ! $request instanceof Request) {
            $request = (new Request())->createFromIlluminate($request);
        }

        return $request;
    }
1143366
public function getACLRequest()
    {
        $operation = array(
            'API' => 'GetBucketACL',
            'Method' => 'GET',
            'Uri' => '/<bucket-name>?acl',
            'Headers' => array(
                'Host' => $this->properties['zone'] . '.' . $this->config->host,
            ),
            'Params' => array(
            ),
            'Elements' => array(
            ),
            'Properties' => $this->properties,
            'Body' => null
        );
        $this->getACLValidate($operation);
        $req = new Request($this->config, $operation);
        return $req;
    }
519438
public final function request()
    {
        if ($this->request == null){
            $this->request = $this->phpContext->createRequest();
        }

        return $this->request;
    }
1187962
public static function get()
    {
        $instance = new static;

        $request = new Request($instance->functionCall, $instance->module);        

        $instance->fill($request->execute());

        return $instance;
    }
697379
public function create()
  {
    $class = ClassGen::classGen(
      $this->entityName . 'Controller',
      $this->namespace,
      ['Phrest\API\Controllers\RESTController'],
      'RESTController'
    );

    foreach ($this->entityDefinition->requests as $requestMethod => $actions)
    {
      foreach ($actions as $actionName => $action)
      {
        if (empty($action))
        {
          continue;
        }

        $getParams = $this->generateGetParamsFromUrl($action->url);
        $postParams = $this->generatePostParams($action);

        $docblock = $this->createDocblockForMethod(
          $requestMethod,
          $action,
          $getParams,
          $postParams
        );

        $method = ClassGen::method($actionName, $getParams, 'public');
        $method->setDocBlock($docblock);

        $body = $this->createBodyForMethod($action);
        $method->setBody($body);

        $class->addMethodFromGenerator($method);
      }
    }

    foreach ($this->uses as $use)
    {
      $class->addUse($use);
    }

    return $class;
  }
1017974
protected function createRequest()
    {
        $request = $this->requestFactory->createRequest($this->method, $this->getEndpoint());

        return $this->queryHelper->applyToRequest($request);
    }
94183
public function getRequestToken()
    {
        try {
            $response = $this->post('/oauth/initiate')->send();
        } catch (ClientErrorResponseException $e) {
            throw OauthException::factory($e->getRequest(), $e->getResponse());
        }
        return new RequestToken($this, $response);
    }
138948
public function request() {
		if(!($vs_method = $this->getRequestMethod())) {
			return false;
		}

		$va_get = array();
		foreach($this->getAllGetParameters() as $vs_name => $vs_val) {
			$va_get[] = $vs_name."=".urlencode($vs_val);
		}

		if(strlen($this->ops_auth_token) > 0) {
			$va_get[] = 'authToken='.$this->ops_auth_token;
		}

		$vs_get = sizeof($va_get)>0 ? "?".join("&",$va_get) : "";

		$vs_query_url = preg_replace("/\/$/", '', $this->ops_service_url."/".$this->getEndpoint().$vs_get);
		$vo_handle = curl_init($vs_query_url);

		curl_setopt($vo_handle, CURLOPT_CUSTOMREQUEST, $vs_method);
		curl_setopt($vo_handle, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($vo_handle, CURLOPT_SSL_VERIFYHOST, 0);
		curl_setopt($vo_handle, CURLOPT_SSL_VERIFYPEER, 0);
		curl_setopt($vo_handle, CURLOPT_FOLLOWLOCATION, true);

		$va_body = $this->getRequestBody();
		if(is_array($va_body) && sizeof($va_body)>0) {
			curl_setopt($vo_handle, CURLOPT_POSTFIELDS, json_encode($va_body));
		}

		$vs_exec = curl_exec($vo_handle);
		$vn_code = curl_getinfo($vo_handle, CURLINFO_HTTP_CODE);
		curl_close($vo_handle);

		if($vn_code == 401) { // try to re-authenticate if access denied
			// discard previous token
			if(strlen($this->ops_auth_token)) {
				@file_put_contents($this->ops_token_storage_path, '');
			}

			if(!$this->authenticate()) { // make up json result for failed authentication
				return new ServiceResult('{ "ok": false, "errors": ["access denied"] }');
			} else { // auth successful, try again
				return $this->request();
			}
		}

		return new ServiceResult($vs_exec);
	}