Skip to content

Commit 068eedf

Browse files
committed
Move Magento\Sales\Model\Order\Address\Validator logic from construct to validate method
1 parent a089cfe commit 068eedf

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
@@ -60,6 +60,16 @@ public function __construct(
6060
$this->countryFactory = $countryFactory;
6161
$this->eavConfig = $eavConfig ?: ObjectManager::getInstance()
6262
->get(EavConfig::class);
63+
}
64+
65+
/**
66+
*
67+
* @param \Magento\Sales\Model\Order\Address $address
68+
* @return array
69+
*/
70+
public function validate(Address $address)
71+
{
72+
$warnings = [];
6373

6474
if ($this->isTelephoneRequired()) {
6575
$this->required['telephone'] = 'Phone Number';
@@ -72,16 +82,7 @@ public function __construct(
7282
if ($this->isFaxRequired()) {
7383
$this->required['fax'] = 'Fax';
7484
}
75-
}
7685

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

0 commit comments

Comments
 (0)