@@ -56,7 +56,7 @@ public function __construct() {
56
56
*
57
57
* @return array Array of routes
58
58
*/
59
- public function getRoutes () {
59
+ public function routes () {
60
60
return $ this ->routes ;
61
61
}
62
62
@@ -74,7 +74,7 @@ public function clear() {
74
74
* @param callback $callback Callback function
75
75
* @param array $config Pass the matching route object to the callback
76
76
*/
77
- public function map ( $ pattern , $ callback , array $ config = [] ): Route {
77
+ public function map ($ pattern , $ callback , array $ config = []): Route {
78
78
$ url = trim ( $ pattern );
79
79
$ methods = [ 'GET ' , 'POST ' , 'PUT ' , 'PATCH ' , 'DELETE ' , 'OPTIONS ' , 'HEAD ' ];
80
80
@@ -86,9 +86,9 @@ public function map( $pattern, $callback, array $config = [] ): Route {
86
86
87
87
$ route = new Route ( $ url , $ callback , $ methods , $ config );
88
88
foreach ( $ methods as $ method ) {
89
- $ this ->routes [$ method ][] = $ route ;
89
+ $ this ->routes [ $ method ][] = $ route ;
90
90
}
91
-
91
+
92
92
return $ route ;
93
93
}
94
94
@@ -99,51 +99,51 @@ public function map( $pattern, $callback, array $config = [] ): Route {
99
99
* @param callback $callback Callback function
100
100
* @param array $config Pass the matching route object to the callback
101
101
*/
102
- public function head ( $ pattern , $ callback , array $ config = [] ): Route {
102
+ public function head ($ pattern , $ callback , array $ config = []): Route {
103
103
return $ this ->map ( 'HEAD ' . $ pattern , $ callback , $ config );
104
104
}
105
-
105
+
106
106
/**
107
107
* Maps a GET URL pattern to a callback function.
108
108
*
109
109
* @param string $pattern URL pattern to match
110
110
* @param callback $callback Callback function
111
111
* @param array $config Pass the matching route object to the callback
112
112
*/
113
- public function get ( $ pattern , $ callback , array $ config = [] ): Route {
113
+ public function get ($ pattern , $ callback , array $ config = []): Route {
114
114
return $ this ->map ( 'GET ' . $ pattern , $ callback , $ config );
115
115
}
116
-
116
+
117
117
/**
118
118
* Maps a POST URL pattern to a callback function.
119
119
*
120
120
* @param string $pattern URL pattern to match
121
121
* @param callback $callback Callback function
122
122
* @param array $config Pass the matching route object to the callback
123
123
*/
124
- public function post ( $ pattern , $ callback , array $ config = [] ): Route {
124
+ public function post ($ pattern , $ callback , array $ config = []): Route {
125
125
return $ this ->map ( 'POST ' . $ pattern , $ callback , $ config );
126
126
}
127
-
127
+
128
128
/**
129
129
* Maps a PUT URL pattern to a callback function.
130
130
*
131
131
* @param string $pattern URL pattern to match
132
132
* @param callback $callback Callback function
133
133
* @param array $config Pass the matching route object to the callback
134
134
*/
135
- public function put ( $ pattern , $ callback , array $ config = [] ): Route {
135
+ public function put ($ pattern , $ callback , array $ config = []): Route {
136
136
return $ this ->map ( 'PUT ' . $ pattern , $ callback , $ config );
137
137
}
138
-
138
+
139
139
/**
140
140
* Maps a DELETE URL pattern to a callback function.
141
141
*
142
142
* @param string $pattern URL pattern to match
143
143
* @param callback $callback Callback function
144
144
* @param array $config Pass the matching route object to the callback
145
145
*/
146
- public function delete ( $ pattern , $ callback , array $ config = [] ): Route {
146
+ public function delete ($ pattern , $ callback , array $ config = []): Route {
147
147
return $ this ->map ( 'DELETE ' . $ pattern , $ callback , $ config );
148
148
}
149
149
@@ -153,10 +153,10 @@ public function delete( $pattern, $callback, array $config = [] ): Route {
153
153
* @param Request $request Request object
154
154
* @return Route|bool Matching route or false if no match
155
155
*/
156
- public function route ( Request $ request ) {
156
+ public function route (Request $ request ) {
157
157
$ url_decoded = urldecode ( $ request ->url );
158
158
159
- $ bucket = $ this ->routes [$ request ->method ];
159
+ $ bucket = $ this ->routes [ $ request ->method ];
160
160
161
161
foreach ( $ bucket as $ route ) {
162
162
if ( $ route ->matchUrl ( $ url_decoded , $ this ->case_sensitive ) ) {
@@ -166,4 +166,5 @@ public function route( Request $request ) {
166
166
167
167
return false ;
168
168
}
169
+
169
170
}
0 commit comments