Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
ad9b49a2
Commit
ad9b49a2
authored
Nov 23, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract callback validation into method.
parent
05e365d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
route.php
laravel/routing/route.php
+15
-2
No files found.
laravel/routing/route.php
View file @
ad9b49a2
...
...
@@ -61,12 +61,25 @@ class Route {
$this
->
uris
=
array_map
(
array
(
$this
,
'extract'
),
explode
(
', '
,
$key
));
}
if
(
!
$
callback
instanceof
Closure
and
!
is_array
(
$callback
)
and
!
is_string
(
$callback
))
if
(
!
$
this
->
callable
(
$callback
))
{
throw
new
\InvalidArgumentException
(
'Invalid route defined for URI ['
.
$this
->
key
.
']'
);
}
}
/**
* Determine if the given route callback is callable.
*
* Route callbacks must be either a Closure, array, or string.
*
* @param mixed $callback
* @return bool
*/
protected
function
callable
(
$callback
)
{
return
$callback
instanceof
Closure
or
is_array
(
$callback
)
or
is_string
(
$callback
);
}
/**
* Retrieve the URI from a given route destination.
*
...
...
@@ -226,4 +239,4 @@ class Route {
throw
new
\BadMethodCallException
(
"Call to undefined method [
$method
] on Route class."
);
}
}
}
\ 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