-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRedirect.php
47 lines (41 loc) · 1.09 KB
/
Redirect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @author Artemii Karkusha
* @copyright Copyright (c) (https://www.linkedin.com/in/artemiy-karkusha/)
*/
declare(strict_types=1);
namespace ArtemiiKarkusha\AdobeCommercePreparingToCertification\Controller\ActionsResults;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\Controller\Result\RedirectFactory as ResultRedirectFactory;
/**
* Controller example with result object the Redirect
*/
class Redirect implements HttpGetActionInterface
{
/**
* @param ResultRedirectFactory $resultRedirectFactory
*/
public function __construct(
private ResultRedirectFactory $resultRedirectFactory
) {
}
/**
* @inheritDoc
*/
public function execute(): ResultInterface
{
return $this->resultRedirectFactory->create()
->setPath(
$this->getRedirectUPath()
);
}
/**
* @return string
*/
private function getRedirectUPath(): string
{
return '/';
}
}