<commit_before><?php

namespace Nebula;


/**
 * Class Router
 * 路由配置示例：
 * $routes->mappings['default'] = array(
 *     'expression' => '/{controller}?/{action}?/{id}?',
 *     'handler' => array(
 *         'matched' => 'TestController@index',
 *         'before'  => function ($params, $route) {
 *             echo 'default2 before.';
 *         },
 *         'after'   => function ($params) {
 *             echo 'default2 after.';
 *         }
 *     ),
 *     'pattern' => array(
 *         'controller' => '',
 *         'action' => '',
 *         'id' => '',
 *     ),
 * );
 * @package Nebula
 * @author lbob created at 2014/11/19 19:52
 */
class Routes
{
    const PATTERN_BASE = '[a-z][a-z0-9\_\-]*';
    const PATTERN_ID = '[\d]+';
    const PATTERN_NAME = '[a-z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*';
    const PATTERN_TAIL = '.+';
    const PATTERN_TOKEN = '#\{([^\{\}]+)\}#i';
    const PATTERN_TOKEN_LESS = '#(\\/)(\{[^\{\}]+\}\?)#i';
    const PATTERN_HANDLER_DECLARE = '#([a-zA-z][a-zA-Z0-9\_]*)\@([a-z][a-z0-9\_]*)#i';
    const PATTERN_NAMESPACE = '#^\/?([^\{\}]+[a-zA-Z0-9])#i';

    public $mappings = array();
    public $baseMappings
        = array(
            'default' => array(
                'expression' => '/{controller}?/{action}?/{id}?',
                'default' => array(
                    'controller' => 'home',
                    'action' => 'index'
                )
            ),
        );
    public $loaded = false;

    private $tokenDefaultPatterns
        = array(
            'controller' => self::PATTERN_BASE,
            'action'     => self::PATTERN_BASE,
            'id'         => self::PATTERN_ID,
            'name'       => self::PATTERN_NAME,<commit_msg>删除 baseMappings 中的 default 路由的 default 配置节点。<commit_after><?php

namespace Nebula;


/**
 * Class Router
 * 路由配置示例：
 * $routes->mappings['default'] = array(
 *     'expression' => '/{controller}?/{action}?/{id}?',
 *     'handler' => array(
 *         'matched' => 'TestController@index',
 *         'before'  => function ($params, $route) {
 *             echo 'default2 before.';
 *         },
 *         'after'   => function ($params) {
 *             echo 'default2 after.';
 *         }
 *     ),
 *     'pattern' => array(
 *         'controller' => '',
 *         'action' => '',
 *         'id' => '',
 *     ),
 * );
 * @package Nebula
 * @author lbob created at 2014/11/19 19:52
 */
class Routes
{
    const PATTERN_BASE = '[a-z][a-z0-9\_\-]*';
    const PATTERN_ID = '[\d]+';
    const PATTERN_NAME = '[a-z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*';
    const PATTERN_TAIL = '.+';
    const PATTERN_TOKEN = '#\{([^\{\}]+)\}#i';
    const PATTERN_TOKEN_LESS = '#(\\/)(\{[^\{\}]+\}\?)#i';
    const PATTERN_HANDLER_DECLARE = '#([a-zA-z][a-zA-Z0-9\_]*)\@([a-z][a-z0-9\_]*)#i';
    const PATTERN_NAMESPACE = '#^\/?([^\{\}]+[a-zA-Z0-9])#i';

    public $mappings = array();
    public $baseMappings
        = array(
            'default' => array(
                'expression' => '/{controller}?/{action}?/{id}?',
            ),
        );
    public $loaded = false;

    private $tokenDefaultPatterns
        = array(
            'controller' => self::PATTERN_BASE,
            'action'     => self::PATTERN_BASE,
            'id'         => self::PATTERN_ID,
            'name'       => self::PATTERN_NAME,
{'fraction_non_alphanumeric': 0.22449593740595847, 'fraction_numerical': 0.015648510382184774, 'mean_word_length': 1.8929503916449086, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, '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': '4689064', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1169, 'n_words': 189}