Skip to content

Commit

Permalink
Made renderer classes readonly [SLE-192]
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgfeller committed Jan 19, 2024
1 parent 2e67e07 commit 4da78a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
5 changes: 1 addition & 4 deletions src/Application/Renderer/JsonEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@

use Psr\Http\Message\ResponseInterface;

class JsonEncoder
readonly class JsonEncoder
{
/**
* Write JSON to the response body.
*
* This method prepares the response object to return an HTTP JSON
* response to the client.
*
* @param ResponseInterface $response The response
* @param mixed $data The data
* @param int $status
Expand Down
11 changes: 2 additions & 9 deletions src/Application/Renderer/RedirectHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,11 @@
use Psr\Http\Message\ResponseInterface;
use Slim\Interfaces\RouteParserInterface;

class RedirectHandler
readonly class RedirectHandler
{
private RouteParserInterface $routeParser;

/**
* The constructor.
*
* @param RouteParserInterface $routeParser The route parser
*/
public function __construct(RouteParserInterface $routeParser)
public function __construct(private RouteParserInterface $routeParser)
{
$this->routeParser = $routeParser;
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/Application/Renderer/TemplateRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@

readonly class TemplateRenderer
{
public function __construct(
private PhpRenderer $phpRenderer,
) {
public function __construct(private PhpRenderer $phpRenderer)
{
}

/**
* Output rendered template.
* Render template.
*
* @param ResponseInterface $response The response
* @param string $template Template pathname relative to templates directory
Expand Down

0 comments on commit 4da78a1

Please sign in to comment.