<commit_before><?php

declare(strict_types=1);

namespace Brick\App;

/**
 * Represents a match between a route and a request as returned by Route::match().
 */
class RouteMatch
{
    /**
     * @var \ReflectionFunctionAbstract
     */
    private $controller;

    /**
     * @var array
     */
    private $classParameters = [];

    /**
     * @var array
     */
    private $functionParameters = [];

    /**
     * @param \ReflectionFunctionAbstract $controller         A reflection of the controller.
     * @param array                       $classParameters    An associative array of parameters matched from the request to resolve the controller class constructor parameters.
     * @param array                       $functionParameters An associative array of parameters matched from the request to resolve the controller function parameters.
     */
    public function __construct(\ReflectionFunctionAbstract $controller, array $classParameters = [], array $functionParameters = [])
    {
        $this->controller         = $controller;
        $this->classParameters    = $classParameters;
        $this->functionParameters = $functionParameters;
    }

    /**
     * Returns a RouteMatch for the given class and method.
     *
     * @param string $class
     * @param string $method
     * @param array  $classParameters
     * @param array  $functionParameters
     *
     * @return RouteMatch The route match.
     *
     * @throws RoutingException If the class or method does not exist.
     */
    public static function forMethod(string $class, string $method, array $classParameters = [], array $functionParameters = []) : RouteMatch
    {
        try {
            $controller = new \ReflectionMethod($class, $method);
        } catch (\ReflectionException $e) {
            throw RoutingException::invalidControllerClassMethod($e, $class, $method);
        }

        return new RouteMatch($controller, $classParameters, $functionParameters);
    }

    /**
     * Returns a RouteMatch for the given function or closure.
     *
     * @param string|\Closure $function
     * @param array           $functionParameters
     *
     * @return RouteMatch The route match.
     *
     * @throws RoutingException If the function is invalid.
     */
    public static function forFunction($function, array $functionParameters = []) : RouteMatch<commit_msg>Rename parameter for consistency<commit_after><?php

declare(strict_types=1);

namespace Brick\App;

/**
 * Represents a match between a route and a request as returned by Route::match().
 */
class RouteMatch
{
    /**
     * @var \ReflectionFunctionAbstract
     */
    private $controller;

    /**
     * @var array
     */
    private $classParameters = [];

    /**
     * @var array
     */
    private $functionParameters = [];

    /**
     * @param \ReflectionFunctionAbstract $controller         A reflection of the controller.
     * @param array                       $classParameters    An associative array of parameters matched from the request to resolve the controller class constructor parameters.
     * @param array                       $functionParameters An associative array of parameters matched from the request to resolve the controller function parameters.
     */
    public function __construct(\ReflectionFunctionAbstract $controller, array $classParameters = [], array $functionParameters = [])
    {
        $this->controller         = $controller;
        $this->classParameters    = $classParameters;
        $this->functionParameters = $functionParameters;
    }

    /**
     * Returns a RouteMatch for the given class and method.
     *
     * @param string $class
     * @param string $method
     * @param array  $classParameters
     * @param array  $methodParameters
     *
     * @return RouteMatch The route match.
     *
     * @throws RoutingException If the class or method does not exist.
     */
    public static function forMethod(string $class, string $method, array $classParameters = [], array $methodParameters = []) : RouteMatch
    {
        try {
            $controller = new \ReflectionMethod($class, $method);
        } catch (\ReflectionException $e) {
            throw RoutingException::invalidControllerClassMethod($e, $class, $method);
        }

        return new RouteMatch($controller, $classParameters, $methodParameters);
    }

    /**
     * Returns a RouteMatch for the given function or closure.
     *
     * @param string|\Closure $function
     * @param array           $functionParameters
     *
     * @return RouteMatch The route match.
     *
     * @throws RoutingException If the function is invalid.
     */
    public static function forFunction($function, array $functionParameters = []) : RouteMatch
{'fraction_non_alphanumeric': 0.0936384631534747, 'fraction_numerical': 0.000419903422212891, 'mean_word_length': 2.528888888888889, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6843172', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1126, 'n_words': 380}