Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
Routing
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3/**
4 * This file is part of CodeIgniter 4 framework.
5 *
6 * (c) CodeIgniter Foundation <admin@codeigniter.com>
7 *
8 * For the full copyright and license information, please view
9 * the LICENSE file that was distributed with this source code.
10 */
11
12namespace Config;
13
14use CodeIgniter\Config\Routing as BaseRouting;
15
16/**
17 * Routing configuration
18 */
19class Routing extends BaseRouting
20{
21    /**
22     * For Defined Routes.
23     * An array of files that contain route definitions.
24     * Route files are read in order, with the first match
25     * found taking precedence.
26     *
27     * Default: APPPATH . 'Config/Routes.php'
28     *
29     * @var list<string>
30     */
31    public array $routeFiles = [
32        APPPATH . 'Config/Routes.php',
33    ];
34
35    /**
36     * For Defined Routes and Auto Routing.
37     * The default namespace to use for Controllers when no other
38     * namespace has been specified.
39     *
40     * Default: 'App\Controllers'
41     */
42    public string $defaultNamespace = 'App\Controllers';
43
44    /**
45     * For Auto Routing.
46     * The default controller to use when no other controller has been
47     * specified.
48     *
49     * Default: 'Home'
50     */
51    public string $defaultController = 'Home';
52
53    /**
54     * For Defined Routes and Auto Routing.
55     * The default method to call on the controller when no other
56     * method has been set in the route.
57     *
58     * Default: 'index'
59     */
60    public string $defaultMethod = 'index';
61
62    /**
63     * For Auto Routing.
64     * Whether to translate dashes in URIs for controller/method to underscores.
65     * Primarily useful when using the auto-routing.
66     *
67     * Default: false
68     */
69    public bool $translateURIDashes = false;
70
71    /**
72     * Sets the class/method that should be called if routing doesn't
73     * find a match. It can be the controller/method name like: Users::index
74     *
75     * This setting is passed to the Router class and handled there.
76     *
77     * If you want to use a closure, you will have to set it in the
78     * routes file by calling:
79     *
80     * $routes->set404Override(function() {
81     *    // Do something here
82     * });
83     *
84     * Example:
85     *  public $override404 = 'App\Errors::show404';
86     */
87    public ?string $override404 = null;
88
89    /**
90     * If TRUE, the system will attempt to match the URI against
91     * Controllers by matching each segment against folders/files
92     * in APPPATH/Controllers, when a match wasn't found against
93     * defined routes.
94     *
95     * If FALSE, will stop searching and do NO automatic routing.
96     */
97    public bool $autoRoute = false;
98
99    /**
100     * If TRUE, the system will look for attributes on controller
101     * class and methods that can run before and after the
102     * controller/method.
103     *
104     * If FALSE, will ignore any attributes.
105     */
106    public bool $useControllerAttributes = true;
107
108    /**
109     * For Defined Routes.
110     * If TRUE, will enable the use of the 'prioritize' option
111     * when defining routes.
112     *
113     * Default: false
114     */
115    public bool $prioritize = false;
116
117    /**
118     * For Defined Routes.
119     * If TRUE, matched multiple URI segments will be passed as one parameter.
120     *
121     * Default: false
122     */
123    public bool $multipleSegmentsOneParam = false;
124
125    /**
126     * For Auto Routing (Improved).
127     * Map of URI segments and namespaces.
128     *
129     * The key is the first URI segment. The value is the controller namespace.
130     * E.g.,
131     *   [
132     *       'blog' => 'Acme\Blog\Controllers',
133     *   ]
134     *
135     * @var array<string, string>
136     */
137    public array $moduleRoutes = [];
138
139    /**
140     * For Auto Routing (Improved).
141     * Whether to translate dashes in URIs for controller/method to CamelCase.
142     * E.g., blog-controller -> BlogController
143     *
144     * If you enable this, $translateURIDashes is ignored.
145     *
146     * Default: false
147     */
148    public bool $translateUriToCamelCase = true;
149}