@@ -50,24 +50,34 @@ class AnalyticsHelper
50
50
*/
51
51
private $ analyticsConfig ;
52
52
53
+ /**
54
+ * Region can be modified via the Magento configuration
55
+ *
56
+ * @var string
57
+ */
58
+ protected $ region ;
59
+
53
60
/**
54
61
* @param AlgoliaHelper $algoliaHelper
55
62
* @param ConfigHelper $configHelper
56
63
* @param IndexEntityDataProvider $entityHelper
57
64
* @param Logger $logger
65
+ * @param string $region
58
66
*/
59
67
public function __construct (
60
68
AlgoliaHelper $ algoliaHelper ,
61
69
ConfigHelper $ configHelper ,
62
70
IndexEntityDataProvider $ entityHelper ,
63
- Logger $ logger
71
+ Logger $ logger ,
72
+ string $ region = 'us '
64
73
) {
65
74
$ this ->algoliaHelper = $ algoliaHelper ;
66
75
$ this ->configHelper = $ configHelper ;
67
76
68
77
$ this ->entityHelper = $ entityHelper ;
69
78
70
79
$ this ->logger = $ logger ;
80
+ $ this ->region = $ this ->configHelper ->getAnalyticsRegion ();
71
81
}
72
82
73
83
private function setupAnalyticsClient ()
@@ -76,18 +86,17 @@ private function setupAnalyticsClient()
76
86
return ;
77
87
}
78
88
79
- $ region = $ this ->configHelper ->getAnalyticsRegion ();
80
89
81
90
$ this ->analyticsClient = AnalyticsClient::create (
82
91
$ this ->configHelper ->getApplicationID (),
83
92
$ this ->configHelper ->getAPIKey (),
84
- $ region
93
+ $ this -> region
85
94
);
86
95
87
96
$ this ->analyticsConfig = AnalyticsConfig::create (
88
97
$ this ->configHelper ->getApplicationID (),
89
98
$ this ->configHelper ->getAPIKey (),
90
- $ region
99
+ $ this -> region
91
100
);
92
101
}
93
102
0 commit comments