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\Helper; |
23
|
|
|
|
24
|
|
|
use Magento\Customer\Model\Session as CustomerSession; |
|
|
|
|
25
|
|
|
use Magento\Framework\App\Helper\AbstractHelper; |
|
|
|
|
26
|
|
|
use Magento\Framework\App\Helper\Context; |
|
|
|
|
27
|
|
|
use Magento\Store\Model\ScopeInterface; |
|
|
|
|
28
|
|
|
use Mageprince\Faq\Model\Config\DefaultConfig; |
29
|
|
|
use Magento\Framework\App\Http\Context as AuthContext; |
|
|
|
|
30
|
|
|
|
31
|
|
|
class Data extends AbstractHelper |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @var CustomerSession |
35
|
|
|
*/ |
36
|
|
|
protected $customerSession; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var AuthContext |
40
|
|
|
*/ |
41
|
|
|
protected $authContext; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Data constructor. |
45
|
|
|
* |
46
|
|
|
* @param Context $context |
47
|
|
|
* @param CustomerSession $customerSession |
48
|
|
|
* @param AuthContext $authContext |
49
|
|
|
*/ |
50
|
|
|
public function __construct( |
51
|
|
|
Context $context, |
52
|
|
|
CustomerSession $customerSession, |
53
|
|
|
AuthContext $authContext |
54
|
|
|
) { |
55
|
|
|
$this->customerSession = $customerSession; |
56
|
|
|
$this->authContext = $authContext; |
57
|
|
|
parent::__construct($context); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Get config path |
62
|
|
|
* |
63
|
|
|
* @param string $config |
64
|
|
|
* @return mixed |
65
|
|
|
*/ |
66
|
|
|
public function getConfig($config) |
67
|
|
|
{ |
68
|
|
|
return $this->scopeConfig->getValue( |
69
|
|
|
$config, |
70
|
|
|
ScopeInterface::SCOPE_STORE |
71
|
|
|
); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Get faq url |
76
|
|
|
* |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
|
|
public function getFaqUrl() |
80
|
|
|
{ |
81
|
|
|
return $this->scopeConfig->getValue(DefaultConfig::FAQ_URL_CONFIG_PATH); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Get current customer group id |
86
|
|
|
* |
87
|
|
|
* @return int |
88
|
|
|
*/ |
89
|
|
|
public function getCustomerGroupId() |
90
|
|
|
{ |
91
|
|
|
$customerGroup = 0; |
92
|
|
|
$isLoggedIn = $this->authContext->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH); |
|
|
|
|
93
|
|
|
if ($isLoggedIn) { |
94
|
|
|
$customerGroup = $this->customerSession->getCustomer()->getGroupId(); |
95
|
|
|
} |
96
|
|
|
return $customerGroup; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Check is block data |
101
|
|
|
* |
102
|
|
|
* @param string $data |
103
|
|
|
* @return bool |
104
|
|
|
*/ |
105
|
|
|
public function checkBlockData($data) |
106
|
|
|
{ |
107
|
|
|
if ($data == '1') { |
108
|
|
|
return true; |
109
|
|
|
} elseif ($data == '0') { |
110
|
|
|
return false; |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Check is module enabled |
116
|
|
|
* |
117
|
|
|
* @return bool |
118
|
|
|
*/ |
119
|
|
|
public function isEnable() |
120
|
|
|
{ |
121
|
|
|
return $this->scopeConfig->getValue(DefaultConfig::CONFIG_PATH_IS_ENABLE); |
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
|
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