Skip to content

Commit 28b047e

Browse files
committed
Move Magento\Sales\Model\Order\Address\Validator logic from construct to validate method
1 parent 8f737c0 commit 28b047e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

app/code/Magento/Sales/Model/Order/Address/Validator.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ public function __construct(
6161
$this->countryFactory = $countryFactory;
6262
$this->eavConfig = $eavConfig ?: ObjectManager::getInstance()
6363
->get(EavConfig::class);
64+
}
65+
66+
/**
67+
*
68+
* @param \Magento\Sales\Model\Order\Address $address
69+
* @return array
70+
*/
71+
public function validate(Address $address)
72+
{
73+
$warnings = [];
6474

6575
if ($this->isTelephoneRequired()) {
6676
$this->required['telephone'] = 'Phone Number';
@@ -73,16 +83,7 @@ public function __construct(
7383
if ($this->isFaxRequired()) {
7484
$this->required['fax'] = 'Fax';
7585
}
76-
}
7786

78-
/**
79-
*
80-
* @param \Magento\Sales\Model\Order\Address $address
81-
* @return array
82-
*/
83-
public function validate(Address $address)
84-
{
85-
$warnings = [];
8687
foreach ($this->required as $code => $label) {
8788
if (!$address->hasData($code)) {
8889
$warnings[] = sprintf('"%s" is required. Enter and try again.', $label);

0 commit comments

Comments
 (0)