Move from 'respond' to 'handle' for the controller method.

This commit is contained in:
Dave Smith-Hayes 2024-06-16 21:25:22 -04:00
parent 98c34efea5
commit 079bcb0f06
8 changed files with 14 additions and 14 deletions

View File

@ -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');

View File

@ -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.

View File

@ -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');
}

View File

@ -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');
}

View File

@ -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([

View File

@ -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');
}

View File

@ -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
{

View File

@ -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;