2020-05-31 20:44:14 +02:00
|
|
|
<?php namespace MapGuesser\Controller;
|
|
|
|
|
2023-04-07 20:28:14 +02:00
|
|
|
use SokoWeb\Interfaces\Request\IRequest;
|
|
|
|
use SokoWeb\Interfaces\Response\IContent;
|
|
|
|
use SokoWeb\Interfaces\Response\IRedirect;
|
|
|
|
use SokoWeb\Response\JsonContent;
|
|
|
|
use SokoWeb\Response\Redirect;
|
2020-05-31 20:44:14 +02:00
|
|
|
|
|
|
|
class HomeController
|
|
|
|
{
|
2020-06-25 14:01:17 +02:00
|
|
|
private IRequest $request;
|
|
|
|
|
|
|
|
public function __construct(IRequest $request)
|
|
|
|
{
|
|
|
|
$this->request = $request;
|
|
|
|
}
|
|
|
|
|
2020-05-31 20:44:14 +02:00
|
|
|
public function getIndex(): IRedirect
|
|
|
|
{
|
2020-06-21 01:27:37 +02:00
|
|
|
return new Redirect(\Container::$routeCollection->getRoute('maps')->generateLink(), IRedirect::TEMPORARY);
|
2020-05-31 20:44:14 +02:00
|
|
|
}
|
2020-06-25 14:01:17 +02:00
|
|
|
|
|
|
|
public function startSession(): IContent
|
|
|
|
{
|
|
|
|
// session starts with the request, this method just sends valid data to the client
|
|
|
|
|
2020-07-05 00:58:03 +02:00
|
|
|
return new JsonContent(['antiCsrfToken' => $this->request->session()->get('anti_csrf_token')]);
|
2020-06-25 14:01:17 +02:00
|
|
|
}
|
2020-05-31 20:44:14 +02:00
|
|
|
}
|