Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 865af1e

Browse files
committedApr 4, 2019
Add composer support for Magento 2.3.x / code cleanup
1 parent a527780 commit 865af1e

File tree

20 files changed

+267
-147
lines changed

20 files changed

+267
-147
lines changed
 

‎Block/Adminhtml/Order/View/GuestToCustomerButtonList.php

+26-11
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
11
<?php
2-
2+
/**
3+
* Copyright © MagePal LLC. All rights reserved.
4+
* See COPYING.txt for license details.
5+
* https://www.magepal.com | support@magepal.com
6+
*/
37

48
namespace MagePal\GuestToCustomer\Block\Adminhtml\Order\View;
59

6-
class GuestToCustomerButtonList extends \Magento\Backend\Block\Widget\Button\ButtonList
10+
use Magento\Backend\Block\Widget\Button\ButtonList;
11+
use Magento\Backend\Block\Widget\Button\ItemFactory;
12+
use Magento\Framework\Registry;
13+
use Magento\Framework\UrlInterface;
14+
use Magento\Sales\Api\Data\OrderInterface;
15+
use MagePal\GuestToCustomer\Helper\Data;
16+
17+
/**
18+
* Class GuestToCustomerButtonList
19+
* @package MagePal\GuestToCustomer\Block\Adminhtml\Order\View
20+
*/
21+
class GuestToCustomerButtonList extends ButtonList
722
{
823
/**
924
* GuestToCustomerButtonList constructor.
10-
* @param \Magento\Backend\Block\Widget\Button\ItemFactory $itemFactory
11-
* @param \Magento\Framework\Registry $coreRegistry
12-
* @param \Magento\Framework\UrlInterface $urlBuilder
13-
* @param \MagePal\GuestToCustomer\Helper\Data $helperData
25+
* @param ItemFactory $itemFactory
26+
* @param Registry $coreRegistry
27+
* @param UrlInterface $urlBuilder
28+
* @param Data $helperData
1429
*/
1530
public function __construct(
16-
\Magento\Backend\Block\Widget\Button\ItemFactory $itemFactory,
17-
\Magento\Framework\Registry $coreRegistry,
18-
\Magento\Framework\UrlInterface $urlBuilder,
19-
\MagePal\GuestToCustomer\Helper\Data $helperData
31+
ItemFactory $itemFactory,
32+
Registry $coreRegistry,
33+
UrlInterface $urlBuilder,
34+
Data $helperData
2035
) {
2136
parent::__construct($itemFactory);
2237

23-
/** @var \Magento\Sales\Api\Data\OrderInterface $order */
38+
/** @var OrderInterface $order */
2439
$order = $coreRegistry->registry('current_order');
2540

2641
if ($helperData->isEnabled() && $order && !$order->getCustomerId()) {

‎Block/Adminhtml/System/Config/Form/Composer/Version.php

+38-21
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,56 @@
22
/**
33
* Copyright © MagePal LLC. All rights reserved.
44
* See COPYING.txt for license details.
5-
* http://www.magepal.com | support@magepal.com
6-
*/
5+
* https://www.magepal.com | support@magepal.com
6+
*/
77

88
namespace MagePal\GuestToCustomer\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\GuestToCustomer\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+
* @param Context $context
45+
* @param DeploymentConfig $deploymentConfig
46+
* @param ComponentRegistrarInterface $componentRegistrar
47+
* @param ReadFactory $readFactory
48+
* @param array $data
3249
*/
3350
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,
51+
Context $context,
52+
DeploymentConfig $deploymentConfig,
53+
ComponentRegistrarInterface $componentRegistrar,
54+
ReadFactory $readFactory,
3855
array $data = []
3956
) {
4057
$this->deploymentConfig = $deploymentConfig;
@@ -46,11 +63,11 @@ public function __construct(
4663
/**
4764
* Render button
4865
*
49-
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
66+
* @param AbstractElement $element
5067
* @return string
51-
* @throws \Magento\Framework\Exception\LocalizedException
68+
* @throws LocalizedException
5269
*/
53-
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
70+
public function render(AbstractElement $element)
5471
{
5572
// Remove scope label
5673
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
@@ -60,11 +77,11 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
6077
/**
6178
* Return element html
6279
*
63-
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
80+
* @param AbstractElement $element
6481
* @return string
6582
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6683
*/
67-
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
84+
protected function _getElementHtml(AbstractElement $element)
6885
{
6986
return 'v' . $this->getVersion();
7087
}
@@ -93,12 +110,12 @@ public function getModuleName()
93110
* Get module composer version
94111
*
95112
* @param $moduleName
96-
* @return \Magento\Framework\Phrase|string|void
113+
* @return Phrase|string|void
97114
*/
98115
public function getComposerVersion($moduleName)
99116
{
100117
$path = $this->componentRegistrar->getPath(
101-
\Magento\Framework\Component\ComponentRegistrar::MODULE,
118+
ComponentRegistrar::MODULE,
102119
$moduleName
103120
);
104121

@@ -110,7 +127,7 @@ public function getComposerVersion($moduleName)
110127
$data = json_decode($composerJsonData);
111128
return !empty($data->version) ? $data->version : __('Unknown');
112129
}
113-
} catch (\Exception $e) {
130+
} catch (Exception $e) {
114131
//
115132
}
116133

‎Block/Adminhtml/System/Config/Form/Module/Version.php

+23-13
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,37 @@
22
/**
33
* Copyright © MagePal LLC. All rights reserved.
44
* See COPYING.txt for license details.
5-
* http://www.magepal.com | support@magepal.com
6-
*/
5+
* https://www.magepal.com | support@magepal.com
6+
*/
77

88
namespace MagePal\GuestToCustomer\Block\Adminhtml\System\Config\Form\Module;
99

10-
class Version extends \Magento\Config\Block\System\Config\Form\Field
10+
use Magento\Backend\Block\Template\Context;
11+
use Magento\Config\Block\System\Config\Form\Field;
12+
use Magento\Framework\Data\Form\Element\AbstractElement;
13+
use Magento\Framework\Exception\LocalizedException;
14+
use Magento\Framework\Module\ModuleListInterface;
15+
16+
/**
17+
* Class Version
18+
* @package MagePal\GuestToCustomer\Block\Adminhtml\System\Config\Form\Module
19+
*/
20+
class Version extends Field
1121
{
1222

1323
/**
14-
* @var \Magento\Framework\Module\ModuleListInterface
24+
* @var ModuleListInterface
1525
*/
1626
protected $_moduleList;
1727

1828
/**
19-
* @param \Magento\Backend\Block\Template\Context $context
20-
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
29+
* @param Context $context
30+
* @param ModuleListInterface $moduleList
2131
* @param array $data
2232
*/
2333
public function __construct(
24-
\Magento\Backend\Block\Template\Context $context,
25-
\Magento\Framework\Module\ModuleListInterface $moduleList,
34+
Context $context,
35+
ModuleListInterface $moduleList,
2636
array $data = []
2737
) {
2838
parent::__construct($context, $data);
@@ -32,11 +42,11 @@ public function __construct(
3242
/**
3343
* Render button
3444
*
35-
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
45+
* @param AbstractElement $element
3646
* @return string
37-
* @throws \Magento\Framework\Exception\LocalizedException
47+
* @throws LocalizedException
3848
*/
39-
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
49+
public function render(AbstractElement $element)
4050
{
4151
// Remove scope label
4252
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
@@ -46,11 +56,11 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
4656
/**
4757
* Return element html
4858
*
49-
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
59+
* @param AbstractElement $element
5060
* @return string
5161
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5262
*/
53-
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
63+
protected function _getElementHtml(AbstractElement $element)
5464
{
5565
return 'v' . $this->getVersion();
5666
}

‎Block/Customer/LookupForm.php

+29-10
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,38 @@
22
/**
33
* Copyright © MagePal LLC. All rights reserved.
44
* See COPYING.txt for license details.
5-
* http://www.magepal.com | support@magepal.com
6-
*/
5+
* https://www.magepal.com | support@magepal.com
6+
*/
77

88
namespace MagePal\GuestToCustomer\Block\Customer;
99

1010
use Magento\Customer\Api\AccountManagementInterface;
1111
use Magento\Customer\Api\CustomerRepositoryInterface;
12+
use Magento\Customer\Api\Data\CustomerInterface;
13+
use Magento\Customer\Model\Session;
14+
use Magento\Framework\View\Element\Template;
15+
use Magento\Framework\View\Element\Template\Context;
16+
use Magento\Newsletter\Model\Subscriber;
17+
use Magento\Newsletter\Model\SubscriberFactory;
1218

13-
class LookupForm extends \Magento\Framework\View\Element\Template
19+
/**
20+
* Class LookupForm
21+
* @package MagePal\GuestToCustomer\Block\Customer
22+
*/
23+
class LookupForm extends Template
1424
{
1525
/**
16-
* @var \Magento\Newsletter\Model\Subscriber
26+
* @var Subscriber
1727
*/
1828
protected $subscription;
1929

2030
/**
21-
* @var \Magento\Customer\Model\Session
31+
* @var Session
2232
*/
2333
protected $customerSession;
2434

2535
/**
26-
* @var \Magento\Newsletter\Model\SubscriberFactory
36+
* @var SubscriberFactory
2737
*/
2838
protected $subscriberFactory;
2939

@@ -37,10 +47,19 @@ class LookupForm extends \Magento\Framework\View\Element\Template
3747
*/
3848
protected $customerAccountManagement;
3949

50+
/**
51+
* LookupForm constructor.
52+
* @param Context $context
53+
* @param Session $customerSession
54+
* @param SubscriberFactory $subscriberFactory
55+
* @param CustomerRepositoryInterface $customerRepository
56+
* @param AccountManagementInterface $customerAccountManagement
57+
* @param array $data
58+
*/
4059
public function __construct(
41-
\Magento\Framework\View\Element\Template\Context $context,
42-
\Magento\Customer\Model\Session $customerSession,
43-
\Magento\Newsletter\Model\SubscriberFactory $subscriberFactory,
60+
Context $context,
61+
Session $customerSession,
62+
SubscriberFactory $subscriberFactory,
4463
CustomerRepositoryInterface $customerRepository,
4564
AccountManagementInterface $customerAccountManagement,
4665
array $data = []
@@ -55,7 +74,7 @@ public function __construct(
5574
/**
5675
* Return the Customer given the customer Id stored in the session.
5776
*
58-
* @return \Magento\Customer\Api\Data\CustomerInterface
77+
* @return CustomerInterface
5978
*/
6079
public function getCustomer()
6180
{

‎Block/View/Element/Html/Link/Current.php

+16-7
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,37 @@
22
/**
33
* Copyright © MagePal LLC, Inc. All rights reserved.
44
* See COPYING.txt for license details.
5-
* http://www.magepal.com | support@magepal.com
5+
* https://www.magepal.com | support@magepal.com
66
*/
77
namespace MagePal\GuestToCustomer\Block\View\Element\Html\Link;
88

9+
use Magento\Framework\App\DefaultPathInterface;
10+
use Magento\Framework\View\Element\Template\Context;
11+
use MagePal\GuestToCustomer\Helper\Data;
12+
13+
/**
14+
* Class Current
15+
* @package MagePal\GuestToCustomer\Block\View\Element\Html\Link
16+
*/
917
class Current extends \Magento\Framework\View\Element\Html\Link\Current
1018
{
1119

12-
/* @var \MagePal\GuestToCustomer\Helper\Data*/
20+
/* @var Data*/
1321
protected $helperData;
1422

1523
/**
1624
* Constructor
1725
*
18-
* @param \Magento\Framework\View\Element\Template\Context $context
19-
* @param \MagePal\GuestToCustomer\Helper\Data $helperData
26+
* @param Context $context
27+
* @param DefaultPathInterface $defaultPath
2028
* @param array $data
29+
* @param Data $helperData
2130
*/
2231
public function __construct(
23-
\Magento\Framework\View\Element\Template\Context $context,
24-
\Magento\Framework\App\DefaultPathInterface $defaultPath,
32+
Context $context,
33+
DefaultPathInterface $defaultPath,
2534
array $data = [],
26-
\MagePal\GuestToCustomer\Helper\Data $helperData
35+
Data $helperData
2736
) {
2837
parent::__construct($context, $defaultPath, $data);
2938
$this->helperData = $helperData;
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Please sign in to comment.