7
7
8
8
namespace MagePal \EditOrderEmail \Block \Adminhtml \System \Config \Form \Composer ;
9
9
10
- class Version extends \Magento \Config \Block \System \Config \Form \Field
10
+ use Exception ;
11
+ use Magento \Backend \Block \Template \Context ;
12
+ use Magento \Config \Block \System \Config \Form \Field ;
13
+ use Magento \Framework \App \DeploymentConfig ;
14
+ use Magento \Framework \Component \ComponentRegistrar ;
15
+ use Magento \Framework \Component \ComponentRegistrarInterface ;
16
+ use Magento \Framework \Data \Form \Element \AbstractElement ;
17
+ use Magento \Framework \Exception \LocalizedException ;
18
+ use Magento \Framework \Filesystem \Directory \ReadFactory ;
19
+ use Magento \Framework \Phrase ;
20
+
21
+ class Version extends Field
11
22
{
12
23
13
24
/**
14
- * @var \Magento\Framework\App\ DeploymentConfig
25
+ * @var DeploymentConfig
15
26
*/
16
27
protected $ deploymentConfig ;
17
28
18
29
/**
19
- * @var \Magento\Framework\Component\ ComponentRegistrarInterface
30
+ * @var ComponentRegistrarInterface
20
31
*/
21
32
protected $ componentRegistrar ;
22
33
23
34
/**
24
- * @var \Magento\Framework\Filesystem\Directory\ ReadFactory
35
+ * @var ReadFactory
25
36
*/
26
37
protected $ readFactory ;
27
38
28
39
/**
29
- * @param \Magento\Framework\App\ DeploymentConfig $deploymentConfig
30
- * @param \Magento\Framework\Component\ ComponentRegistrarInterface $componentRegistrar
31
- * @param \Magento\Framework\Filesystem\Directory\ ReadFactory $readFactory
40
+ * @param DeploymentConfig $deploymentConfig
41
+ * @param ComponentRegistrarInterface $componentRegistrar
42
+ * @param ReadFactory $readFactory
32
43
*/
33
44
public function __construct (
34
- \ Magento \ Backend \ Block \ Template \ Context $ context ,
35
- \ Magento \ Framework \ App \ DeploymentConfig $ deploymentConfig ,
36
- \ Magento \ Framework \ Component \ ComponentRegistrarInterface $ componentRegistrar ,
37
- \ Magento \ Framework \ Filesystem \ Directory \ ReadFactory $ readFactory ,
45
+ Context $ context ,
46
+ DeploymentConfig $ deploymentConfig ,
47
+ ComponentRegistrarInterface $ componentRegistrar ,
48
+ ReadFactory $ readFactory ,
38
49
array $ data = []
39
50
) {
40
51
$ this ->deploymentConfig = $ deploymentConfig ;
@@ -46,11 +57,11 @@ public function __construct(
46
57
/**
47
58
* Render button
48
59
*
49
- * @param \Magento\Framework\Data\Form\Element\ AbstractElement $element
60
+ * @param AbstractElement $element
50
61
* @return string
51
- * @throws \Magento\Framework\Exception\ LocalizedException
62
+ * @throws LocalizedException
52
63
*/
53
- public function render (\ Magento \ Framework \ Data \ Form \ Element \ AbstractElement $ element )
64
+ public function render (AbstractElement $ element )
54
65
{
55
66
// Remove scope label
56
67
$ element ->unsScope ()->unsCanUseWebsiteValue ()->unsCanUseDefaultValue ();
@@ -60,11 +71,11 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
60
71
/**
61
72
* Return element html
62
73
*
63
- * @param \Magento\Framework\Data\Form\Element\ AbstractElement $element
74
+ * @param AbstractElement $element
64
75
* @return string
65
76
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
66
77
*/
67
- protected function _getElementHtml (\ Magento \ Framework \ Data \ Form \ Element \ AbstractElement $ element )
78
+ protected function _getElementHtml (AbstractElement $ element )
68
79
{
69
80
return 'v ' . $ this ->getVersion ();
70
81
}
@@ -93,12 +104,12 @@ public function getModuleName()
93
104
* Get module composer version
94
105
*
95
106
* @param $moduleName
96
- * @return \Magento\Framework\ Phrase|string|void
107
+ * @return Phrase|string|void
97
108
*/
98
109
public function getComposerVersion ($ moduleName )
99
110
{
100
111
$ path = $ this ->componentRegistrar ->getPath (
101
- \ Magento \ Framework \ Component \ ComponentRegistrar::MODULE ,
112
+ ComponentRegistrar::MODULE ,
102
113
$ moduleName
103
114
);
104
115
@@ -110,7 +121,7 @@ public function getComposerVersion($moduleName)
110
121
$ data = json_decode ($ composerJsonData );
111
122
return !empty ($ data ->version ) ? $ data ->version : __ ('Unknown ' );
112
123
}
113
- } catch (\ Exception $ e ) {
124
+ } catch (Exception $ e ) {
114
125
//
115
126
}
116
127
0 commit comments