<commit_before><?php

namespace Symfony\Cmf\Component\Routing\NestedMatcher;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
use Symfony\Component\Routing\Route;
use Symfony\Cmf\Component\Routing\RouteProviderInterface;

/**
 * A more flexible approach to matching. The route collection to match against
 * can be dynamically determined based on the request and users can inject
 * their own filters or use a custom final matching strategy.
 *
 * The nested matcher splits matching into three configurable steps:
 *
 * 1) Get potential matches from a RouteProviderInterface
 * 2) Apply any RouteFilterInterface to reduce the route collection
 * 3) Have FinalMatcherInterface select the best match of the remaining routes
 *
 * @author <NAME>
 * @author <NAME>
 */
class NestedMatcher implements RequestMatcherInterface
{
    /**
     * The route provider responsible for the first-pass match.
     *
     * @var RouteProviderInterface
     */
    protected $routeProvider;

    /**
     * The final matcher.
     *
     * @var FinalMatcherInterface
     */
    protected $finalMatcher;

    /**
     * An array of RouteFilterInterface objects.
     *
     * @var RouteFilterInterface[]
     */
    protected $filters = array();

    /**
     * Array of RouteFilterInterface objects, sorted.
     *
     * @var RouteFilterInterface[]
     */
    protected $sortedFilters = array();

    /**
     * Constructs a new NestedMatcher
     *
     * @param RouteProviderInterface $provider The Route Provider this matcher
     *                                         should use
     * @param FinalMatcherInterface  $final    The Final Matcher to match the
     *                                         routes
     */
    public function __construct(
        RouteProviderInterface $provider = null,
        FinalMatcherInterface $final = null
    ) {
        $this->setRouteProvider($provider);
        $this->setFinalMatcher($final);
    }

    /**
     * Sets the route provider for the matching plan.
     *
     * @param RouteProviderInterface $provider A route provider. It is
     *      responsible for its own configuration.<commit_msg>make constructor arguments truly optional<commit_after><?php

namespace Symfony\Cmf\Component\Routing\NestedMatcher;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
use Symfony\Component\Routing\Route;
use Symfony\Cmf\Component\Routing\RouteProviderInterface;

/**
 * A more flexible approach to matching. The route collection to match against
 * can be dynamically determined based on the request and users can inject
 * their own filters or use a custom final matching strategy.
 *
 * The nested matcher splits matching into three configurable steps:
 *
 * 1) Get potential matches from a RouteProviderInterface
 * 2) Apply any RouteFilterInterface to reduce the route collection
 * 3) Have FinalMatcherInterface select the best match of the remaining routes
 *
 * @author <NAME>
 * @author <NAME>
 */
class NestedMatcher implements RequestMatcherInterface
{
    /**
     * The route provider responsible for the first-pass match.
     *
     * @var RouteProviderInterface
     */
    protected $routeProvider;

    /**
     * The final matcher.
     *
     * @var FinalMatcherInterface
     */
    protected $finalMatcher;

    /**
     * An array of RouteFilterInterface objects.
     *
     * @var RouteFilterInterface[]
     */
    protected $filters = array();

    /**
     * Array of RouteFilterInterface objects, sorted.
     *
     * @var RouteFilterInterface[]
     */
    protected $sortedFilters = array();

    /**
     * Constructs a new NestedMatcher
     *
     * @param RouteProviderInterface $provider The Route Provider this matcher
     *                                         should use
     * @param FinalMatcherInterface  $final    The Final Matcher to match the
     *                                         routes
     */
    public function __construct(
        RouteProviderInterface $provider = null,
        FinalMatcherInterface $final = null
    ) {
        if (null !== $provider) {
            $this->setRouteProvider($provider);
        }
        if (null !== $final) {
            $this->setFinalMatcher($final);
        }
    }

    /**
     * Sets the route provider for the matching plan.
     *
     * @param RouteProviderInterface $provider A route provider. It is
     *      responsible for its own configuration.
{'fraction_non_alphanumeric': 0.07773244578054542, 'fraction_numerical': 0.0012883830792355595, 'mean_word_length': 2.6136539953452287, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '753761', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1121, 'n_words': 381}