Move from 'respond' to 'handle' for the controller method.
This commit is contained in:
parent
98c34efea5
commit
079bcb0f06
@ -7,7 +7,7 @@ use Slovocast\Controller\Controller;
|
||||
|
||||
class CreateChannelPage extends Controller
|
||||
{
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
// set up the form key
|
||||
return $this->render('channel/create.twig');
|
||||
|
@ -34,7 +34,7 @@ abstract class Controller
|
||||
$this->routeContext = RouteContext::fromRequest($this->request);
|
||||
$this->view = Twig::fromRequest($request);
|
||||
|
||||
return $this->respond($request, $response);
|
||||
return $this->handle($request, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,7 +42,7 @@ abstract class Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
abstract public function respond(): Response;
|
||||
abstract public function handle(): Response;
|
||||
|
||||
/**
|
||||
* Render the given Template.
|
||||
|
@ -6,7 +6,7 @@ use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
||||
class HomePage extends Controller
|
||||
{
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
return $this->render('home.twig');
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use Slovocast\Controller\Controller;
|
||||
|
||||
class LoginUserPage extends Controller
|
||||
{
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
return $this->render('user/login');
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class RegisterUserAction extends Controller
|
||||
protected SessionInterface $session
|
||||
) { }
|
||||
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
$requestData = $this->request->getParsedBody();
|
||||
$user = User::fromArray([
|
||||
|
@ -7,7 +7,7 @@ use Slovocast\Controller\Controller;
|
||||
|
||||
class RegisterUserPage extends Controller
|
||||
{
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
return $this->render('user/register.twig');
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ namespace Slovocast\Infrastructure\User;
|
||||
use Slovocast\Infrastructure\User\UserAuthorizationInterface;
|
||||
|
||||
/**
|
||||
* This empty class will essentially just check hashed passwords passed
|
||||
* into it using the default `password_` functions from PHP.
|
||||
* This empty class will essentially just check hashed passwords passed into it
|
||||
* using the default `password_` functions from PHP.
|
||||
*/
|
||||
class BasicUserAuthorization implements UserAuthorizationInterface
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ class ControllerTest extends TestCase
|
||||
public function testHtmlInlineResponse(): void
|
||||
{
|
||||
$testController = new class extends Controller {
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
return $this->renderInline(
|
||||
'<p>{{ name }}</p>',
|
||||
@ -33,7 +33,7 @@ class ControllerTest extends TestCase
|
||||
public function testHtmlInlineResponseCodes(): void
|
||||
{
|
||||
$testController = new class extends Controller {
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
$response = $this->renderInline(
|
||||
'<p>{{ name }}</p>',
|
||||
@ -58,7 +58,7 @@ class ControllerTest extends TestCase
|
||||
public function testJsonResponse(): void
|
||||
{
|
||||
$testController = new class extends Controller {
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
return $this->json([ 'data' => 'hello' ]);
|
||||
}
|
||||
@ -84,7 +84,7 @@ class ControllerTest extends TestCase
|
||||
public function testRenderSiteName(): void
|
||||
{
|
||||
$testController = new class extends Controller {
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
return $this->renderInline("<h1>{{ site_name }}</h1>");
|
||||
}
|
||||
@ -112,7 +112,7 @@ class ControllerTest extends TestCase
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
public function respond(): Response
|
||||
public function handle(): Response
|
||||
{
|
||||
$this->session->getFlash()->add("error", "Error message");
|
||||
return $this->response;
|
||||
|
Loading…
Reference in New Issue
Block a user