Skip to content

Commit

Permalink
Add docblock comments where relevant
Browse files Browse the repository at this point in the history
This change adds docblock comments where relevant to the code so that
it's as clear as possible without going overboard.
  • Loading branch information
settermjd committed Jan 9, 2025
1 parent 2286803 commit 55e5188
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/Middleware/RedirectToNewDomainMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,35 @@

/**
* RedirectToNewDomainMiddleware performs a 301 redirect the current request
* from one domain (oldDomain) to another (newDomain) if the current request is
* from one domain ($oldDomain) to another ($newDomain) if the current request is
* for the old domain. It is designed to simplify moving sites from one domain
* to another, especially in cases where the hosting provider does not provide
* this functionality natively.
*/
final readonly class RedirectToNewDomainMiddleware implements MiddlewareInterface
{
public function __construct(
/**
* This is the host portion of the route that was originally requested, e.g., deploywithdockercompose.com, hollows.org, or rspca.org.au.
*/
private string $oldDomain,

/**
* This is the host portion of the route that the request will be redirected to, e.g., asrc.org.au, wwf.org.au, or blackdoginstitute.org.au.
*/
private string $newDomain,

/**
* If you want to perform basic instrumentation, provide this parameter.
*/
private ?LoggerInterface $logger = null
) {
}
) {}

/**
* process checks the host portion of the current request. If it matches the
* old domain ($oldDomain) the host is set to the new domain ($newDomain)
* and the user is redirected to the revised URI.
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$this->logger
Expand Down

0 comments on commit 55e5188

Please sign in to comment.