1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (c) 2019. Volodymyr Hryvinskyi. All rights reserved. |
4
|
|
|
* @author: <mailto:[email protected]> |
5
|
|
|
* @github: <https://github.com/hryvinskyi> |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
declare(strict_types=1); |
9
|
|
|
|
10
|
|
|
namespace Hryvinskyi\InvisibleCaptcha\Helper\Config; |
11
|
|
|
|
12
|
|
|
use Magento\Framework\App\Helper\AbstractHelper; |
13
|
|
|
use Magento\Store\Model\ScopeInterface; |
|
|
|
|
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Class General |
17
|
|
|
*/ |
18
|
|
|
class General extends AbstractHelper |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Configuration path |
22
|
|
|
*/ |
23
|
|
|
const CONFIG_PATH_GENERAL_ENABLE_MODULE = 'hryvinskyi_invisible_captcha/general/enabledCaptcha'; |
24
|
|
|
const CONFIG_PATH_GENERAL_SITE_KEY = 'hryvinskyi_invisible_captcha/general/captchaSiteKey'; |
25
|
|
|
const CONFIG_PATH_GENERAL_SECRET_KEY = 'hryvinskyi_invisible_captcha/general/captchaSecretKey'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Is google recaptcha enable global |
29
|
|
|
* |
30
|
|
|
* @param string $scopeType |
31
|
|
|
* @param mixed $scopeCode |
32
|
|
|
* |
33
|
|
|
* @return bool |
34
|
|
|
*/ |
35
|
|
|
public function hasEnabled( |
36
|
|
|
string $scopeType = ScopeInterface::SCOPE_WEBSITE, |
37
|
|
|
$scopeCode = null |
38
|
|
|
): bool { |
39
|
|
|
return $this->scopeConfig->isSetFlag( |
40
|
|
|
self::CONFIG_PATH_GENERAL_ENABLE_MODULE, |
41
|
|
|
$scopeType, |
42
|
|
|
$scopeCode |
43
|
|
|
); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Return Captcha Key |
48
|
|
|
* |
49
|
|
|
* @param string $scopeType |
50
|
|
|
* @param mixed $scopeCode |
51
|
|
|
* |
52
|
|
|
* @return string |
53
|
|
|
*/ |
54
|
|
|
public function getSiteKey( |
55
|
|
|
string $scopeType = ScopeInterface::SCOPE_WEBSITE, |
56
|
|
|
$scopeCode = null |
57
|
|
|
): string { |
58
|
|
|
return $this->scopeConfig->getValue( |
59
|
|
|
self::CONFIG_PATH_GENERAL_SITE_KEY, |
60
|
|
|
$scopeType, |
61
|
|
|
$scopeCode |
62
|
|
|
); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Return Secret Key |
67
|
|
|
* |
68
|
|
|
* @param string $scopeType |
69
|
|
|
* @param mixed $scopeCode |
70
|
|
|
* |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
public function getSecretKey( |
74
|
|
|
string $scopeType = ScopeInterface::SCOPE_WEBSITE, |
75
|
|
|
$scopeCode = null |
76
|
|
|
): string { |
77
|
|
|
return $this->scopeConfig->getValue( |
78
|
|
|
self::CONFIG_PATH_GENERAL_SECRET_KEY, |
79
|
|
|
$scopeType, |
80
|
|
|
$scopeCode |
81
|
|
|
); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Get config by path |
86
|
|
|
* |
87
|
|
|
* @param $path |
88
|
|
|
* @param null $storeId |
|
|
|
|
89
|
|
|
* @param string $scope |
90
|
|
|
* |
91
|
|
|
* @return mixed |
92
|
|
|
*/ |
93
|
|
|
public function getConfigValueByPath( |
94
|
|
|
$path, |
95
|
|
|
$storeId = null, |
96
|
|
|
$scope = ScopeInterface::SCOPE_WEBSITE |
97
|
|
|
) { |
98
|
|
|
return $this->scopeConfig->getValue($path, $scope, $storeId); |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|
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