diff --git a/src/Middleware/RedirectToNewDomainMiddleware.php b/src/Middleware/RedirectToNewDomainMiddleware.php index cd41083..e0a628f 100644 --- a/src/Middleware/RedirectToNewDomainMiddleware.php +++ b/src/Middleware/RedirectToNewDomainMiddleware.php @@ -15,7 +15,7 @@ /** * 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. @@ -23,12 +23,27 @@ 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