Server IP : 213.176.29.180  /  Your IP : 3.17.78.182
Web Server : Apache
System : Linux 213.176.29.180.hostiran.name 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
User : webtaragh ( 1001)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/webtaragh/public_html/whmcs/vendor/middlewares/utils/src/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/webtaragh/public_html/whmcs/vendor/middlewares/utils/src/ServerRequestFactory.php
<?php

namespace Middlewares\Utils;

use Interop\Http\Factory\ServerRequestFactoryInterface;

/**
 * Simple class to create server request instances of PSR-7 classes.
 */
class ServerRequestFactory implements ServerRequestFactoryInterface
{
    /**
     * {@inheritdoc}
     */
    public function createServerRequest(array $server, $method = null, $uri = null)
    {
        if (class_exists('Zend\\Diactoros\\ServerRequest')) {
            return new \Zend\Diactoros\ServerRequest(
                $server,
                [],
                (string) $uri,
                $method,
                new \Zend\Diactoros\Stream(fopen('php://temp', 'r+'))
            );
        }

        if (class_exists('GuzzleHttp\\Psr7\\ServerRequest')) {
            return new \GuzzleHttp\Psr7\ServerRequest($method, (string) $uri, [], null, '1.1', $server);
        }

        if (class_exists('Slim\\Http\\Request')) {
            return new \Slim\Http\Request(
                $method,
                \Slim\Http\Uri::createFromString((string) $uri),
                new \Slim\Http\Headers(),
                [],
                $server,
                new \Slim\Http\Stream(fopen('php://temp', 'r+'))
            );
        }

        throw new \RuntimeException('Unable to create a server request. No PSR-7 server request library detected');
    }
}