1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* MagePrince |
4
|
|
|
* |
5
|
|
|
* NOTICE OF LICENSE |
6
|
|
|
* |
7
|
|
|
* This source file is subject to the mageprince.com license that is |
8
|
|
|
* available through the world-wide-web at this URL: |
9
|
|
|
* https://mageprince.com/end-user-license-agreement |
10
|
|
|
* |
11
|
|
|
* DISCLAIMER |
12
|
|
|
* |
13
|
|
|
* Do not edit or add to this file if you wish to upgrade this extension to newer |
14
|
|
|
* version in the future. |
15
|
|
|
* |
16
|
|
|
* @category MagePrince |
17
|
|
|
* @package Mageprince_Faq |
18
|
|
|
* @copyright Copyright (c) MagePrince (https://mageprince.com/) |
19
|
|
|
* @license https://mageprince.com/end-user-license-agreement |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Mageprince\Faq\Controller; |
23
|
|
|
|
24
|
|
|
use Magento\Framework\App\Action\Forward; |
|
|
|
|
25
|
|
|
use Magento\Framework\App\ActionFactory; |
|
|
|
|
26
|
|
|
use Magento\Framework\App\ActionInterface; |
|
|
|
|
27
|
|
|
use Magento\Framework\App\Config\ScopeConfigInterface; |
|
|
|
|
28
|
|
|
use Magento\Framework\App\RequestInterface; |
|
|
|
|
29
|
|
|
use Magento\Framework\App\RouterInterface; |
|
|
|
|
30
|
|
|
use Magento\Store\Model\ScopeInterface; |
|
|
|
|
31
|
|
|
use Mageprince\Faq\Model\Config\DefaultConfig; |
32
|
|
|
|
33
|
|
|
class Router implements RouterInterface |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* @var ActionFactory |
37
|
|
|
*/ |
38
|
|
|
protected $actionFactory; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var ScopeConfigInterface |
42
|
|
|
*/ |
43
|
|
|
protected $scopeConfig; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Router constructor. |
47
|
|
|
* @param ActionFactory $actionFactory |
48
|
|
|
* @param ScopeConfigInterface $scopeConfig |
49
|
|
|
*/ |
50
|
|
|
public function __construct( |
51
|
|
|
ActionFactory $actionFactory, |
52
|
|
|
ScopeConfigInterface $scopeConfig |
53
|
|
|
) { |
54
|
|
|
$this->actionFactory = $actionFactory; |
55
|
|
|
$this->scopeConfig = $scopeConfig; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Faq router |
60
|
|
|
* |
61
|
|
|
* @param RequestInterface $request |
62
|
|
|
* @return ActionInterface|null |
63
|
|
|
*/ |
64
|
|
|
public function match(RequestInterface $request) |
65
|
|
|
{ |
66
|
|
|
$isModuleEnabled = $this->scopeConfig->getValue( |
67
|
|
|
DefaultConfig::CONFIG_PATH_IS_ENABLE, |
68
|
|
|
ScopeInterface::SCOPE_STORE |
69
|
|
|
); |
70
|
|
|
if ($isModuleEnabled) { |
71
|
|
|
$identifier = trim($request->getPathInfo(), '/'); |
72
|
|
|
$faqUrl = $this->scopeConfig->getValue(DefaultConfig::FAQ_URL_CONFIG_PATH); |
73
|
|
|
if ($identifier == $faqUrl) { |
74
|
|
|
$request->setModuleName('faq'); |
75
|
|
|
$request->setControllerName('index'); |
76
|
|
|
$request->setActionName('index'); |
77
|
|
|
return $this->actionFactory->create( |
78
|
|
|
Forward::class |
79
|
|
|
); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
return null; |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths