<commit_before><?php

namespace Reroute\Url;

use Reroute\Url;

class Braces extends Url
{
    /**
     * Check if this URL is a match.
     *
     * @param string $url The requested URL.
     * @param string $method The HTTP method (verb).
     */
    public function match($url, $method)
    {
        $try = preg_replace('@{(\w+)}@', '(\w+)', $this->url);
        if (preg_match("@^{$this->host}$try$@", $url, $matches)) {
            unset($matches[0]);
            foreach ($matches as $key => $value) {
                if (is_numeric($key)) {
                    unset($matches[$key]);
                }
            }
            return $matches;
        }
        return null;
    }

    /**
     * Generate a URL.
     */
    public function generate(array $arguments = [])
    {
        return $this->full(preg_replace_callback(
            "@{(\w+)}@",
            function ($match) use ($arguments) {
                return $arguments[$match[1]];
            },
            $this->url
        ));
    }<commit_msg>check method<commit_after><?php

namespace Reroute\Url;

use Reroute\Url;

class Braces extends Url
{
    /**
     * Check if this URL is a match.
     *
     * @param string $url The requested URL.
     * @param string $method The HTTP method (verb).
     */
    public function match($url, $method)
    {
        $try = preg_replace('@{(\w+)}@', '(\w+)', $this->url);
        if (preg_match("@^{$this->host}$try$@", $url, $matches)
            && in_array($method, $this->verbs)
        ) {
            unset($matches[0]);
            foreach ($matches as $key => $value) {
                if (is_numeric($key)) {
                    unset($matches[$key]);
                }
            }
            return $matches;
        }
        return null;
    }

    /**
     * Generate a URL.
     */
    public function generate(array $arguments = [])
    {
        return $this->full(preg_replace_callback(
            "@{(\w+)}@",
            function ($match) use ($arguments) {
                return $arguments[$match[1]];
            },
            $this->url
        ));
    }
{'fraction_non_alphanumeric': 0.16389548693586697, 'fraction_numerical': 0.0019002375296912114, 'mean_word_length': 1.5651644336175397, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '2440401', 'n_tokens_mistral': 636, 'n_tokens_neox': 628, 'n_words': 145}