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
895d8764
Commit
895d8764
authored
Nov 02, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bugs found when unit testing.
parent
9caf239f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
26 deletions
+45
-26
laravel/response.php
+2
-2
laravel/routing/controller.php
+39
-22
laravel/routing/route.php
+3
-1
laravel/routing/router.php
+1
-1
No files found.
laravel/response.php
View file @
895d8764
...
...
@@ -14,14 +14,14 @@ class Response {
*
* @var int
*/
p
rotected
$status
;
p
ublic
$status
;
/**
* The response headers.
*
* @var array
*/
p
rotected
$headers
=
array
();
p
ublic
$headers
=
array
();
/**
* HTTP status codes.
...
...
laravel/routing/controller.php
View file @
895d8764
...
...
@@ -30,7 +30,7 @@ abstract class Controller {
*
* @param string $destination
* @param array $parameters
* @return
mixed
* @return
Response
*/
public
static
function
call
(
$destination
,
$parameters
=
array
())
{
...
...
@@ -43,30 +43,12 @@ abstract class Controller {
$controller
=
static
::
resolve
(
$controller
);
if
(
is_null
(
$controller
)
or
static
::
hidden
(
$method
)
)
if
(
is_null
(
$controller
))
{
return
Response
::
error
(
'404'
);
}
// Again, as was the case with route closures, if the controller
// "before" filters return a response, it will be considered the
// response to the request and the controller method will not be
// used to handle the request to the application.
$response
=
Filter
::
run
(
$controller
->
filters
(
'before'
),
array
(),
true
);
if
(
is_null
(
$response
))
{
$response
=
call_user_func_array
(
array
(
$controller
,
$method
),
$parameters
);
}
// The after filter and the framework expects all responses to
// be instances of the Response class. If the method did not
// return an instsance of Response, we will make on now.
if
(
!
$response
instanceof
Response
)
$response
=
new
Response
(
$response
);
Filter
::
run
(
$controller
->
filters
(
'after'
),
array
(
$response
));
return
$response
;
return
$controller
->
execute
(
$method
,
$parameters
);
}
/**
...
...
@@ -106,7 +88,7 @@ abstract class Controller {
if
(
file_exists
(
$path
=
CONTROLLER_PATH
.
$controller
.
EXT
))
{
require
$path
;
require
_once
$path
;
return
true
;
}
...
...
@@ -115,6 +97,41 @@ abstract class Controller {
}
/**
* Execute a controller method with the given parameters.
*
* @param string $method
* @param array $parameters
* @return Response
*/
public
function
execute
(
$method
,
$parameters
=
array
())
{
if
(
static
::
hidden
(
$method
))
{
return
Response
::
error
(
'404'
);
}
// Again, as was the case with route closures, if the controller
// "before" filters return a response, it will be considered the
// response to the request and the controller method will not be
// used to handle the request to the application.
$response
=
Filter
::
run
(
$this
->
filters
(
'before'
),
array
(),
true
);
if
(
is_null
(
$response
))
{
$response
=
call_user_func_array
(
array
(
$this
,
$method
),
$parameters
);
}
// The after filter and the framework expects all responses to
// be instances of the Response class. If the method did not
// return an instsance of Response, we will make on now.
if
(
!
$response
instanceof
Response
)
$response
=
new
Response
(
$response
);
Filter
::
run
(
$this
->
filters
(
'after'
),
array
(
$response
));
return
$response
;
}
/**
* Determine if a given controller method is callable.
*
* @param string $method
...
...
laravel/routing/route.php
View file @
895d8764
...
...
@@ -186,7 +186,9 @@ class Route {
{
if
(
is_array
(
$this
->
callback
)
and
isset
(
$this
->
callback
[
$name
]))
{
return
(
array
)
$this
->
callback
[
$name
];
$filters
=
$this
->
callback
[
$name
];
return
(
is_string
(
$filters
))
?
explode
(
'|'
,
$filters
)
:
(
array
)
$filters
;
}
return
array
();
...
...
laravel/routing/router.php
View file @
895d8764
...
...
@@ -272,7 +272,7 @@ class Router {
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
if
(
preg_match
(
'/\(.+\)/'
,
$route
[
$i
]))
if
(
preg_match
(
'/\(.+\)/'
,
$route
[
$i
])
and
isset
(
$uri
[
$i
])
)
{
$parameters
[]
=
$uri
[
$i
];
}
...
...
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