77
88namespace  MagePal \NewsletterSignupEmail \Block \Adminhtml \System \Config \Form \Composer ;
99
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+ /** 
22+  * Class Version 
23+  * @package MagePal\NewsletterSignupEmail\Block\Adminhtml\System\Config\Form\Composer 
24+  */ 
25+ class  Version extends  Field
1126{
1227
1328    /** 
14-      * @var \Magento\Framework\App\ DeploymentConfig 
29+      * @var DeploymentConfig 
1530     */ 
1631    protected  $ deploymentConfig ;
1732
1833    /** 
19-      * @var \Magento\Framework\Component\ ComponentRegistrarInterface 
34+      * @var ComponentRegistrarInterface 
2035     */ 
2136    protected  $ componentRegistrar ;
2237
2338    /** 
24-      * @var \Magento\Framework\Filesystem\Directory\ ReadFactory 
39+      * @var ReadFactory 
2540     */ 
2641    protected  $ readFactory ;
2742
2843    /** 
29-      * @param \Magento\Framework\App\DeploymentConfig $deploymentConfig 
30-      * @param \Magento\Framework\Component\ComponentRegistrarInterface $componentRegistrar 
31-      * @param \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory 
44+      * Version constructor. 
45+      * @param Context $context 
46+      * @param DeploymentConfig $deploymentConfig 
47+      * @param ComponentRegistrarInterface $componentRegistrar 
48+      * @param ReadFactory $readFactory 
49+      * @param array $data 
3250     */ 
3351    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 ,
52+         Context   $ context ,
53+         DeploymentConfig   $ deploymentConfig ,
54+         ComponentRegistrarInterface   $ componentRegistrar ,
55+         ReadFactory   $ readFactory ,
3856        array  $ data  = []
3957    ) {
4058        $ this  ->deploymentConfig  = $ deploymentConfig ;
@@ -46,11 +64,11 @@ public function __construct(
4664    /** 
4765     * Render button 
4866     * 
49-      * @param  \Magento\Framework\Data\Form\Element\ AbstractElement $element 
67+      * @param  AbstractElement $element 
5068     * @return string 
51-      * @throws \Magento\Framework\Exception\ LocalizedException 
69+      * @throws LocalizedException 
5270     */ 
53-     public  function  render (\ Magento \ Framework \ Data \ Form \ Element \ AbstractElement   $ element )
71+     public  function  render (AbstractElement   $ element )
5472    {
5573        // Remove scope label 
5674        $ element ->unsScope ()->unsCanUseWebsiteValue ()->unsCanUseDefaultValue ();
@@ -60,11 +78,11 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
6078    /** 
6179     * Return element html 
6280     * 
63-      * @param  \Magento\Framework\Data\Form\Element\ AbstractElement $element 
81+      * @param  AbstractElement $element 
6482     * @return string 
6583     * @SuppressWarnings(PHPMD.UnusedFormalParameter) 
6684     */ 
67-     protected  function  _getElementHtml (\ Magento \ Framework \ Data \ Form \ Element \ AbstractElement   $ element )
85+     protected  function  _getElementHtml (AbstractElement   $ element )
6886    {
6987        return  'v '  . $ this  ->getVersion ();
7088    }
@@ -93,12 +111,12 @@ public function getModuleName()
93111     * Get module composer version 
94112     * 
95113     * @param $moduleName 
96-      * @return \Magento\Framework\ Phrase|string|void 
114+      * @return Phrase|string|void 
97115     */ 
98116    public  function  getComposerVersion ($ moduleName )
99117    {
100118        $ path  = $ this  ->componentRegistrar ->getPath (
101-             \ Magento \ Framework \ Component \ ComponentRegistrar::MODULE ,
119+             ComponentRegistrar::MODULE ,
102120            $ moduleName
103121        );
104122
@@ -110,7 +128,7 @@ public function getComposerVersion($moduleName)
110128                $ data  = json_decode ($ composerJsonData );
111129                return  !empty ($ data ->version ) ? $ data ->version  : __ ('Unknown ' );
112130            }
113-         } catch  (\ Exception   $ e ) {
131+         } catch  (Exception   $ e ) {
114132            // 
115133        }
116134
0 commit comments