6
6
7
7
namespace Magento \Customer \Model ;
8
8
9
- use Magento \Framework \Indexer \StateInterface ;
10
-
11
9
/**
12
10
* Class Visitor
13
11
* @package Magento\Customer\Model
@@ -67,6 +65,11 @@ class Visitor extends \Magento\Framework\Model\AbstractModel
67
65
*/
68
66
protected $ indexerRegistry ;
69
67
68
+ /**
69
+ * @var \Magento\Framework\App\RequestSafetyInterface
70
+ */
71
+ private $ requestSafety ;
72
+
70
73
/**
71
74
* @param \Magento\Framework\Model\Context $context
72
75
* @param \Magento\Framework\Registry $registry
@@ -80,6 +83,7 @@ class Visitor extends \Magento\Framework\Model\AbstractModel
80
83
* @param array $ignoredUserAgents
81
84
* @param array $ignores
82
85
* @param array $data
86
+ * @param \Magento\Framework\App\RequestSafetyInterface|null $requestSafety
83
87
*
84
88
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
85
89
*/
@@ -95,7 +99,8 @@ public function __construct(
95
99
\Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
96
100
array $ ignoredUserAgents = [],
97
101
array $ ignores = [],
98
- array $ data = []
102
+ array $ data = [],
103
+ \Magento \Framework \App \RequestSafetyInterface $ requestSafety = null
99
104
) {
100
105
$ this ->session = $ session ;
101
106
$ this ->httpHeader = $ httpHeader ;
@@ -105,6 +110,7 @@ public function __construct(
105
110
$ this ->scopeConfig = $ scopeConfig ;
106
111
$ this ->dateTime = $ dateTime ;
107
112
$ this ->indexerRegistry = $ indexerRegistry ;
113
+ $ this ->requestSafety = $ requestSafety ;
108
114
}
109
115
110
116
/**
@@ -312,11 +318,9 @@ public function clean()
312
318
*/
313
319
public function getOnlineInterval ()
314
320
{
315
- $ configValue = intval (
316
- $ this ->scopeConfig ->getValue (
317
- static ::XML_PATH_ONLINE_INTERVAL ,
318
- \Magento \Store \Model \ScopeInterface::SCOPE_STORE
319
- )
321
+ $ configValue = (int ) $ this ->scopeConfig ->getValue (
322
+ static ::XML_PATH_ONLINE_INTERVAL ,
323
+ \Magento \Store \Model \ScopeInterface::SCOPE_STORE
320
324
);
321
325
return $ configValue ?: static ::DEFAULT_ONLINE_MINUTES_INTERVAL ;
322
326
}
@@ -332,7 +336,7 @@ private function getRequest()
332
336
{
333
337
if (null === $ this ->requestSafety ) {
334
338
$ this ->requestSafety = \Magento \Framework \App \ObjectManager::getInstance ()->create (
335
- \Magento \Framework \App \RequestInterface ::class
339
+ \Magento \Framework \App \RequestSafetyInterface ::class
336
340
);
337
341
}
338
342
return $ this ->requestSafety ;
0 commit comments