Creates Generic Request from the given HTTP Request (normally $_SERVER).

@param array $headers HTTP Request

@return \UaRequest\GenericRequest
190211
public function createRequestFromArray(array $headers): GenericRequest
    {
        $upperCaseHeaders = [];

        foreach ($headers as $header => $value) {
            $upperCaseHeader = mb_strtoupper(str_replace('-', '_', $header));

            if (0 !== mb_strpos($upperCaseHeader, 'HTTP_')) {
                $upperCaseHeader = 'HTTP_' . $upperCaseHeader;
            }

            if (!HeaderSecurity::isValid($value)) {
                $value = $this->filterHeader($value);
            }

            $upperCaseHeaders[$upperCaseHeader] = $value;
        }

        $message = ServerRequestFactory::fromGlobals($upperCaseHeaders);

        return $this->createRequestFromPsr7Message($message);
    }
31119
private static function serverToHeaders(array $server)
    {
        $headers = array();
        foreach ($server as $key => $value) {
            if (strpos($key, 'HTTP_') === 0) {
                $key = strtolower(str_replace("_", '-', substr($key, 5)));
                $headers[$key] = $value;
            }
        }
        return $headers;
    }
767508
public function create($method, $url, array $headers = [], $body = null)
    {
        return new Request($method, $url, $headers, $body);
    }
1018845
public function createServerRequestFromArray(array $server)
    {
        return new ServerRequest(
            $server['REQUEST_METHOD'] ?? 'GET', 
            $server['REQUEST_URI'], 
            $this->getHeadersFromServerArr($server),
            null,
            $server['SERVER_PROTOCOL'] ?? 'HTTP/1.1',
            $server
        );
    }
232523
public function addDefaultHeaders($headers)
    {
        foreach ($headers as $name => $value) {
            $this->addDefaultHeader($name, $value);
        }

        return $this;
    }
102201
public function load(array $headers = [])
    {
        $data = $this->getApi()->getConfiguration($headers);

        return $this->getFactory()->create($data);
    }
427704
public function addHeaders(array $headers)
    {
        $this->head = array_merge($this->head, $headers);
        curl_setopt($this->curlHandler, CURLOPT_HTTPHEADER, $this->head);
        return $this;
    }
1055599
public function rawRequest(array $data = [], array $headers = []) {
        foreach ($headers as $header => $value) {
            $this->options[CURLOPT_HTTPHEADER][] = $header . ': ' . $value;
        }

        return $this->execute($data);
    }
590948
protected function prepareHeaders(array $headers)
    {
        $preparedHeaders = [];

        foreach ($headers as $strName => $varValue) {
            $preparedHeaders[] = $strName.': '.$varValue;
        }

        return $preparedHeaders;
    }
356983
public function createRequest($url, $method = 'GET', array $headers = [], $body = null)
    {
        $headers = array_merge($headers, ['User-Agent' => strval($this->userAgent)]);
        return new Request($method, $url, $headers, $body);
    }
318401
public function allowHeaders($headers = '*')
    {
        $this->response = $this->corsHandler->setResponse($this->response)
            ->allowHeaders($headers)
            ->getResponse();

        return $this;
    }
149351
public function authHeaders(array $headers = [ ])
    {
        if (count($headers) == 0) {
            $headers = [ 'X-Application' => Auth::$appKey, 'X-Authentication' => Auth::$sessionToken ];
        }
        $this->options[ 'headers' ] = array_merge($this->options[ 'headers' ], $headers);
        return $this;
    }
1098718
private function setRequestHeaders($headers = array()) {
        foreach ($this->headers as $key => $value) {
            $headers[] = $key . ': ' . $value;
        }
        curl_setopt($this->request, CURLOPT_HTTPHEADER, $headers);
    }
128661
public function customRequest($service, $method = 'GET', $headers = null, $data = null)
	{
		$serviceUrl = $this->urlService($service);
		$request = new Request($serviceUrl, $method);
		$headers = $this->recieveHeaders($headers);
		if(null !== $headers)
		{
			$request->setHeaders($headers);
		}
		if(null !== $data)
		{
			$data = $this->dataFormalize($data);
			$request->setContent($data);
		}
		$request->setFormat($this->resource);
		return $request;
	}
780557
public static function connect($url, $headers = [], $parameters = null)
    {
        return Request::create('default')->connect($url, $headers, $parameters);
    }
1103881
public function createServerRequestFromArray(array $server){
        $method     = $server["REQUEST_METHOD"] ?? "GET";

        return new ServerRequest(
            $method,
            (new UriFactory())->createFromServer($server),
            $server,
            self::getUploadedFiles($_FILES),
            $_COOKIE,
            $_GET,
            self::getProtocolVersion($server)
        );
    }
674880
public function addRequestHeaders($headers)
    {
        $currency = $this->client->getCurrencyCode();
        if (!empty($currency)) {
            $headers['X-MOLTIN-CURRENCY'] = $this->client->getCurrencyCode();
        }
        return $headers;
    }