24
24
use Magento \Framework \App \Helper \AbstractHelper ;
25
25
use Magento \Framework \App \Helper \Context ;
26
26
use Magento \Framework \App \ProductMetadataInterface ;
27
+ use Magento \Framework \App \ProductMetadata as FrameworkProductMetaData ;
27
28
use Magento \Framework \App \ResourceConnection ;
28
29
use Magento \Framework \HTTP \Client \Curl ;
29
30
use Magento \Framework \Module \ModuleListInterface ;
@@ -90,6 +91,11 @@ class FBEHelper extends AbstractHelper
90
91
*/
91
92
private $ systemConfig ;
92
93
94
+ /**
95
+ * @var ProductMetadataInterface
96
+ */
97
+ private $ productMetadata ;
98
+
93
99
/**
94
100
* FBEHelper constructor
95
101
*
@@ -101,6 +107,7 @@ class FBEHelper extends AbstractHelper
101
107
* @param ResourceConnection $resourceConnection
102
108
* @param ModuleListInterface $moduleList
103
109
* @param SystemConfig $systemConfig
110
+ * @param ProductMetadataInterface $productMetadata
104
111
*/
105
112
public function __construct (
106
113
Context $ context ,
@@ -110,7 +117,8 @@ public function __construct(
110
117
Curl $ curl ,
111
118
ResourceConnection $ resourceConnection ,
112
119
ModuleListInterface $ moduleList ,
113
- SystemConfig $ systemConfig
120
+ SystemConfig $ systemConfig ,
121
+ ProductMetadataInterface $ productMetadata
114
122
) {
115
123
parent ::__construct ($ context );
116
124
$ this ->objectManager = $ objectManager ;
@@ -120,16 +128,17 @@ public function __construct(
120
128
$ this ->resourceConnection = $ resourceConnection ;
121
129
$ this ->moduleList = $ moduleList ;
122
130
$ this ->systemConfig = $ systemConfig ;
131
+ $ this ->productMetadata = $ productMetadata ;
123
132
}
124
133
125
134
/**
126
135
* Get magento version
127
136
*
128
- * @return mixed
137
+ * @return string
129
138
*/
130
- public function getMagentoVersion ()
139
+ public function getMagentoVersion (): string
131
140
{
132
- return $ this ->objectManager -> get (ProductMetadataInterface::class) ->getVersion ();
141
+ return $ this ->productMetadata ->getVersion ();
133
142
}
134
143
135
144
/**
@@ -147,9 +156,9 @@ public function getPluginVersion()
147
156
*
148
157
* @return string
149
158
*/
150
- public function getSource ()
159
+ public function getSource (): string
151
160
{
152
- return ' magento2 ' ;
161
+ return $ this -> productMetadata -> getEdition () == FrameworkProductMetaData:: EDITION_NAME ? ' magento_opensource ' : ' adobe_commerce ' ;
153
162
}
154
163
155
164
/**
0 commit comments