Skip to content

Commit 8a2c385

Browse files
committed
resolve invoke plugin
1 parent f37cac3 commit 8a2c385

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/Plugin/Page.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use Mvc5\Arg;
99
use Mvc5\Http\Request;
1010
use Mvc5\Plugin\Call;
11-
use Mvc5\Plugin\Link;
12-
use Mvc5\Service\Service;
11+
use Mvc5\Plugin\Invoke;
12+
use Mvc5\Plugin\Plugin;
1313

1414
class Page
1515
extends Call
@@ -20,19 +20,18 @@ class Page
2020
*/
2121
function __construct(string $template, array $vars = [])
2222
{
23-
parent::__construct([$this, '__invoke'], [new Link, $template, $vars]);
23+
parent::__construct([$this, '__invoke'], [$template, $vars]);
2424
}
2525

2626
/**
27-
* @param Service $service
2827
* @param string $template
2928
* @param array $vars
30-
* @return \Closure
29+
* @return Invoke
3130
*/
32-
function __invoke(Service $service, string $template, array $vars) : \Closure
31+
function __invoke(string $template, array $vars) : Invoke
3332
{
34-
return function(Request $request) use($service, $template, $vars) {
35-
return $service->plugin(Arg::VIEW_MODEL, [$template, $vars + [Arg::REQUEST => $request]]);
36-
};
33+
return new Invoke(function(Request $request) use($template, $vars) {
34+
return new Plugin(Arg::VIEW_MODEL, [$template, $vars + [Arg::REQUEST => $request]]);
35+
});
3736
}
3837
}

0 commit comments

Comments
 (0)