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
8affa31a
Commit
8affa31a
authored
Aug 05, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added shortcut syntax for route handlers on named routes.
parent
75a9591c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
system/routing/route.php
+18
-2
No files found.
system/routing/route.php
View file @
8affa31a
...
...
@@ -63,9 +63,9 @@ class Route {
{
$response
=
isset
(
$this
->
callback
[
'before'
])
?
Filter
::
call
(
$this
->
callback
[
'before'
],
array
(),
true
)
:
null
;
if
(
is_null
(
$response
)
and
isset
(
$this
->
callback
[
'do'
]
))
if
(
is_null
(
$response
)
and
!
is_null
(
$handler
=
$this
->
handler
()
))
{
$response
=
call_user_func_array
(
$
this
->
callback
[
'do'
]
,
$this
->
parameters
);
$response
=
call_user_func_array
(
$
handler
,
$this
->
parameters
);
}
}
...
...
@@ -79,4 +79,19 @@ class Route {
return
$response
;
}
/**
* Extract the route function from the route.
*
* @return Closure
*/
private
function
handler
()
{
if
(
isset
(
$this
->
callback
[
'do'
]))
return
$this
->
callback
[
'do'
];
foreach
(
$this
->
callback
as
$value
)
{
if
(
is_callable
(
$value
))
return
$value
;
}
}
}
\ No newline at end of file
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