PHP 8.2.30
Preview: RequestStack.php Size: 2.32 KB
//opt/cloudlinux/alt-php55/root/usr/share/pear/Symfony/Component/HttpFoundation/RequestStack.php

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\HttpFoundation;

/**
 * Request stack that controls the lifecycle of requests.
 *
 * @author Benjamin Eberlei <kontakt@beberlei.de>
 */
class RequestStack
{
    /**
     * @var Request[]
     */
    private $requests = array();

    /**
     * Pushes a Request on the stack.
     *
     * This method should generally not be called directly as the stack
     * management should be taken care of by the application itself.
     */
    public function push(Request $request)
    {
        $this->requests[] = $request;
    }

    /**
     * Pops the current request from the stack.
     *
     * This operation lets the current request go out of scope.
     *
     * This method should generally not be called directly as the stack
     * management should be taken care of by the application itself.
     *
     * @return Request|null
     */
    public function pop()
    {
        if (!$this->requests) {
            return null;
        }

        return array_pop($this->requests);
    }

    /**
     * @return Request|null
     */
    public function getCurrentRequest()
    {
        return end($this->requests) ?: null;
    }

    /**
     * Gets the master Request.
     *
     * Be warned that making your code aware of the master request
     * might make it un-compatible with other features of your framework
     * like ESI support.
     *
     * @return Request|null
     */
    public function getMasterRequest()
    {
        if (!$this->requests) {
            return null;
        }

        return $this->requests[0];
    }

    /**
     * Returns the parent request of the current.
     *
     * Be warned that making your code aware of the parent request
     * might make it un-compatible with other features of your framework
     * like ESI support.
     *
     * If current Request is the master request, it returns null.
     *
     * @return Request|null
     */
    public function getParentRequest()
    {
        $pos = count($this->requests) - 2;

        if (!isset($this->requests[$pos])) {
            return null;
        }

        return $this->requests[$pos];
    }
}

Directory Contents

Dirs: 3 × Files: 21

Name Size Perms Modified Actions
File DIR
- drwxr-xr-x 2024-03-03 22:54:39
Edit Download
Resources DIR
- drwxr-xr-x 2024-03-03 22:54:39
Edit Download
Session DIR
- drwxr-xr-x 2024-03-03 22:54:39
Edit Download
3.53 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
4.80 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
930 B lrw-r--r-- 2019-12-18 11:24:06
Edit Download
344 B lrw-r--r-- 2019-12-18 11:24:06
Edit Download
9.43 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
4.95 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
1.33 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
3.94 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
7.95 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
3.43 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
4.52 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
7.91 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
2.63 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
54.60 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
3.71 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
791 B lrw-r--r-- 2019-12-18 11:24:06
Edit Download
2.32 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
34.97 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
8.64 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
3.62 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download
3.14 KB lrw-r--r-- 2019-12-18 11:24:06
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).