Gets the current request derived from the PHP context.
519438
public final function request()
    {
        if ($this->request == null){
            $this->request = $this->phpContext->createRequest();
        }

        return $this->request;
    }
457708
protected static function getRequestUrl()
    {
        $hostname = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null);

        if(isset($hostname))
        {
            $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';

            if(!isset($_SERVER['REQUEST_URI']))
            {
                if(isset($_SERVER['QUERY_STRING']))
                {
                    return $protocol . '://' . $hostname . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
                }
                else
                {
                    return $protocol . '://' . $hostname . $_SERVER['PHP_SELF'];
                }
            }
            else
            {
                return $protocol . '://' . $hostname . $_SERVER['REQUEST_URI'];
            }
        }
        else
        {
            return null;
        }
    }
558285
public static function getContext()
    {
        $coID = Coroutine::getuid();
        if(!isset(static::$context[$coID]))
        {
            throw new \RuntimeException('get context failed, current context is not found');
        }
        return static::$context[$coID];
    }
200098
public static function getCurrentUrl(): string
    {
        $siteUrl = self::getSiteUrl();
        
        $request = self::getServerVariable('REQUEST_URI', self::getServerVariable('PHP_SELF', ''));
        $query = self::getQueryString();
        
        $indexPhpFound = strpos($request, INDEX_FILE);
        if (!USE_INDEX_FILE && ($indexPhpFound === 0 || $indexPhpFound === 1)) {
            // remove index.php
            $request = str_replace(INDEX_FILE, '', $request);
        }
        
        $currentUrl = $siteUrl . $request;
        if (!empty($query) && strpos($request, $query) === false) {
            $currentUrl .= '?' . $query;
        }
        
        return preg_replace("#([^:])//+#", "$1/", $currentUrl);
    }
923550
protected function loadRawFromRequest()
    {
        if (static::$raw) {
            return static::$raw;
        }

        static::$raw = file_get_contents('php://input');

        // This is a workaround for where php://input has already been read.
        // See note under php://input on http://php.net/manual/en/wrappers.php.php
        if (empty($this->raw) && isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
            static::$raw = $GLOBALS['HTTP_RAW_POST_DATA'];
        }

        return static::$raw;
    }
102490
public function getBaseRequest()
    {
        if (!isset($this->baseRequest)) {
            $this->baseRequest = new ServerRequest();
        }
        
        $request = $this->baseRequest;
        
        if ($request instanceof GlobalEnvironmentInterface && $request->isStale() === false) {
            $request = $request->withGlobalEnvironment(true); // Make sure base request is stale
        }
        
        return $request;
    }
79949
def current(self):
        
        if not has_request_context():
            return self.no_req_ctx_user_stack.top
        user_stack = getattr(_request_ctx_stack.top, 'user_stack', None)
        if user_stack and user_stack.top:
            return user_stack.top
        return _get_user()
315364
public function generateResponse($request = null, $currentUrlFragment = false)
    {
        if ($currentUrlFragment === false) {
            $currentUrlFragment = $request->urlPath;
        }

        if (!$this->matchesRequest($request, $currentUrlFragment)) {
            return false;
        }

        UrlHandler::setExecutingUrlHandler($this);

        Log::debug(function () {
            return "Handler " . get_class($this) . " selected to generate response";
        }, "ROUTER");

        Log::indent();

        $context = new PhpContext();
        $context->UrlHandler = $this;

        $this->matchingUrl = $this->getMatchingUrlFragment($request, $currentUrlFragment);

        if ($this->parentHandler) {
            $this->handledUrl = $this->parentHandler->handledUrl . $this->matchingUrl;
        } else {
            $this->handledUrl = $this->matchingUrl;
        }

        $childUrlFragment = substr($currentUrlFragment, strlen($this->matchingUrl));

        foreach ($this->childUrlHandlers as $childHandler) {
            $response = $childHandler->generateResponse($request, $childUrlFragment);

            if ($response !== false) {
                return $response;
            }
        }

        $response = $this->generateResponseForRequest($request, $currentUrlFragment);

        Log::debug(function () use ($response) {
            if ($response !== false) {
                return "Response generated by handler";
            }

            return "Handler deferred generation";
        }, "ROUTER");

        Log::outdent();

        return $response;
    }
766939
public static function current()
    {
        if (defined('PHPUNIT_RUNNING')) {
            return 'http://localhost';
        }

        $protocol = (!empty($_SERVER['HTTPS'])
            && $_SERVER['HTTPS'] !== 'off'
            || (int) $_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://';

        return $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }
1299086
public function load(): Request
    {
        global $argv;

        $this
            ->setArgs($argv)
            ->setContent(file_get_contents('php://input'));

        if (isset($_COOKIE)) {
            $this->setCookies($_COOKIE);
        }

        // @codeCoverageIgnoreStart
        if (isset($_SESSION)) {
            $this->setSession($_SESSION);
        }
        // @codeCoverageIgnoreEnd

        if (isset($_GET)) {
            $this->setGet($_GET)->setStage($_GET);
        }

        if (isset($_POST)) {
            $this->setPost($_POST)->setStage($_POST);
        }

        if (isset($_FILES)) {
            $this->setFiles($_FILES);
        }

        if (isset($_SERVER)) {
            $this->setServer($_SERVER);
        }

        return $this;
    }
774829
public static function getCurrentUrl()
    {
        return self::getCurrentScheme() . '://'
        . self::getCurrentHost()
        . self::getCurrentScriptName(false)
        . self::getCurrentQueryString();
    }
959838
private function getCurrentRequestContent()
    {
        $currentRequest = $this->requestStack->getCurrentRequest();
        if (!is_null($currentRequest)) {
            $this->currentRequestContent = json_decode($currentRequest->getContent());
        }
        return $this->currentRequestContent;
    }
419478
protected function _getCurrentStateFromRequest() {
        $here = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
        $queryString = parse_url($here, PHP_URL_QUERY);
        parse_str($queryString, $queryComponents);      
        if (!empty($queryComponents[Garp_Browsebox::BROWSEBOX_QUERY_IDENTIFIER][$this->getId()])) {
            $chunk = $queryComponents[Garp_Browsebox::BROWSEBOX_QUERY_IDENTIFIER][$this->getId()];          
            return $chunk;
        }
        return null;
    }
254579
public function current_action()
    {
        if (isset($_REQUEST['action']) && -1 != $_REQUEST['action']) {
            return $_REQUEST['action'];
        }

        if (isset($_REQUEST['action2']) && -1 != $_REQUEST['action2']) {
            return $_REQUEST['action2'];
        }

        return false;
    }
359222
public function getMethod()
    {
        // Get actual request method
        $method = $this->env->get('REQUEST_METHOD');
        $methodOverride = $this->headers->get('HTTP_X_HTTP_METHOD_OVERRIDE');

        // Detect method override (by HTTP header or POST parameter)
        if (!empty($methodOverride)) {
            $method = strtoupper($methodOverride);
        } else if ($method === static::METHOD_POST) {
            $customMethod = $this->post(static::METHOD_OVERRIDE, false);
            if ($customMethod !== false) {
                $method = strtoupper($customMethod);
            }
        }

        return $method;
    }
484140
private function _request()
    {
        if ($this->_request) {
            return $this->_request;
        }
        $this->_request = Zend_Controller_Front::getInstance()->getRequest();
        return $this->_request;
    }
1233846
public function getRequest()
    {
        if (null == $this->request) {
            $this->setRequest(Application::container()->get('request'));
        }
        return $this->request;
    }