1 | <?php |
||
11 | final class ReceiveCode implements RouteCallbackInterface |
||
12 | { |
||
13 | const ROUTE = '/receive-code'; |
||
14 | |||
15 | /** |
||
16 | * The slim framework view Helper. |
||
17 | * |
||
18 | * @var object |
||
19 | */ |
||
20 | private $view; |
||
21 | |||
22 | /** |
||
23 | * The template for /receive-code |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | private $template; |
||
28 | |||
29 | /** |
||
30 | * Construct a new instance of ReceiveCode route. |
||
31 | * |
||
32 | * @param object $view The slim framework view helper. |
||
33 | * @param string $template The template for /receive-code. |
||
34 | * |
||
35 | * @throws \InvalidArgumentException Thrown if $view is not an object implementing a render method. |
||
36 | */ |
||
37 | public function __construct($view, $template = '/receive-code.phtml') |
||
38 | { |
||
39 | if (!is_object($view) || !method_exists($view, 'render')) { |
||
40 | throw new \InvalidArgumentException('$view must implement a render() method'); |
||
41 | } |
||
42 | |||
43 | $this->view = $view; |
||
44 | $this->template = $template; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Invoke this route callback. |
||
49 | * |
||
50 | * @param ServerRequestInterface $request Represents the current HTTP request. |
||
51 | * @param ResponseInterface $response Represents the current HTTP response. |
||
52 | * @param array $arguments Values for the current route’s named placeholders. |
||
53 | * |
||
54 | * @return ResponseInterface |
||
55 | */ |
||
56 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, array $arguments = []) |
||
63 | } |
||
64 |