Skip to content

Commit f37cac3

Browse files
committed
resolve invoke plugin
1 parent 92cc64e commit f37cac3

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/Plugin/Redirect.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,33 @@
77

88
use Mvc5\Arg;
99
use Mvc5\Http\Request;
10-
use Mvc5\Http\Response;
1110
use Mvc5\Plugin\Call;
11+
use Mvc5\Plugin\Invoke;
1212
use Mvc5\Plugin\Plugin;
1313

1414
class Redirect
1515
extends Call
1616
{
1717
/**
1818
* @param string $url
19-
* @param int|null $status
19+
* @param int $status
2020
* @param array $headers
2121
*/
2222
function __construct(string $url, int $status = 302, array $headers = [])
2323
{
24-
parent::__construct([$this, '__invoke'], [new Plugin(Arg::RESPONSE_REDIRECT, [$url, $status, $headers])]);
24+
parent::__construct([$this, '__invoke'], [$url, $status, $headers]);
2525
}
2626

2727
/**
28-
* @param Response $response
29-
* @return \Closure
28+
* @param string $url
29+
* @param int $status
30+
* @param array $headers
31+
* @return Invoke
3032
*/
31-
function __invoke(Response $response) : \Closure
33+
function __invoke(string $url, int $status, array $headers) : Invoke
3234
{
33-
return function(Request $request) use($response) {
34-
return $response;
35-
};
35+
return new Invoke(function(Request $request) use($url, $status, $headers) {
36+
return new Plugin(Arg::RESPONSE_REDIRECT, [$url, $status, $headers]);
37+
});
3638
}
3739
}

0 commit comments

Comments
 (0)