Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
277729ed
Commit
277729ed
authored
Sep 13, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
continued refactoring routing.
parent
2fae372c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
laravel/routing/route.php
+16
-2
No files found.
laravel/routing/route.php
View file @
277729ed
...
...
@@ -47,13 +47,27 @@ class Route {
$this
->
callback
=
$callback
;
$this
->
parameters
=
$parameters
;
// The extractor closure will retrieve the URI from a given route destination.
// If the request is to the root of the application, a single forward slash
// will be returned, otherwise the leading slash will be removed.
$extractor
=
function
(
$segment
)
{
$segment
=
substr
(
$segment
,
strpos
(
$segment
,
' '
)
+
1
);
return
(
$segment
!==
'/'
)
?
trim
(
$segment
,
'/'
)
:
$segment
;
};
// Extract each URI out of the route key. Since the route key has the request
// method, we will extract the method off of the string. If the URI points to
// the root of the application, a single forward slash will be returned.
// Otherwise, the leading slash will be removed.
foreach
(
explode
(
', '
,
$key
)
as
$segment
)
if
(
strpos
(
$key
,
', '
)
===
false
)
{
$this
->
uris
=
array
(
$extractor
(
$this
->
key
));
}
else
{
$this
->
uris
[]
=
(
$segment
=
(
substr
(
$segment
,
strpos
(
$segment
,
' '
)
+
1
))
!==
'/'
)
?
trim
(
$segment
,
'/'
)
:
$segment
;
$this
->
uris
=
array_map
(
function
(
$segment
)
use
(
$extractor
)
{
return
$extractor
(
$segment
);
},
explode
(
', '
,
$key
))
;
}
// The route callback must be either a Closure, an array, or a string. Closures
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment