$66 GRAYBYTE WORDPRESS FILE MANAGER $62

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/alt/php55/usr/share/pear/Symfony/Component/Routing/Matcher/Dumper/

HOME
Current File : /opt/alt/php55/usr/share/pear/Symfony/Component/Routing/Matcher/Dumper//DumperPrefixCollection.php
<?php

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

namespace Symfony\Component\Routing\Matcher\Dumper;

/**
 * Prefix tree of routes preserving routes order.
 *
 * @author Arnaud Le Blanc <[email protected]>
 */
class DumperPrefixCollection extends DumperCollection
{
    /**
     * @var string
     */
    private $prefix = '';

    /**
     * Returns the prefix.
     *
     * @return string The prefix
     */
    public function getPrefix()
    {
        return $this->prefix;
    }

    /**
     * Sets the prefix.
     *
     * @param string $prefix The prefix
     */
    public function setPrefix($prefix)
    {
        $this->prefix = $prefix;
    }

    /**
     * Adds a route in the tree.
     *
     * @param DumperRoute $route The route
     *
     * @return DumperPrefixCollection The node the route was added to
     *
     * @throws \LogicException
     */
    public function addPrefixRoute(DumperRoute $route)
    {
        $prefix = $route->getRoute()->compile()->getStaticPrefix();

        for ($collection = $this; null !== $collection; $collection = $collection->getParent()) {

            // Same prefix, add to current leave
            if ($collection->prefix === $prefix) {
                $collection->add($route);

                return $collection;
            }

            // Prefix starts with route's prefix
            if ('' === $collection->prefix || 0 === strpos($prefix, $collection->prefix)) {
                $child = new DumperPrefixCollection();
                $child->setPrefix(substr($prefix, 0, strlen($collection->prefix)+1));
                $collection->add($child);

                return $child->addPrefixRoute($route);
            }
        }

        // Reached only if the root has a non empty prefix
        throw new \LogicException("The collection root must not have a prefix");
    }

    /**
     * Merges nodes whose prefix ends with a slash
     *
     * Children of a node whose prefix ends with a slash are moved to the parent node
     */
    public function mergeSlashNodes()
    {
        $children = array();

        foreach ($this as $child) {
            if ($child instanceof self) {
                $child->mergeSlashNodes();
                if ('/' === substr($child->prefix, -1)) {
                    $children = array_merge($children, $child->all());
                } else {
                    $children[] = $child;
                }
            } else {
                $children[] = $child;
            }
        }

        $this->setAll($children);
    }
}


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.54 PM
root / root
0755
ApacheMatcherDumper.php
8.869 KB
18 Dec 2019 11.24 AM
root / root
0644
DumperCollection.php
3.52 KB
18 Dec 2019 11.24 AM
root / root
0644
DumperPrefixCollection.php
2.669 KB
18 Dec 2019 11.24 AM
root / root
0644
DumperRoute.php
1.085 KB
18 Dec 2019 11.24 AM
root / root
0644
MatcherDumper.php
0.906 KB
18 Dec 2019 11.24 AM
root / root
0644
MatcherDumperInterface.php
0.965 KB
18 Dec 2019 11.24 AM
root / root
0644
PhpMatcherDumper.php
13.001 KB
18 Dec 2019 11.24 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF