Skip to content

Commit eb97904

Browse files
committed
array_map updated instead of foreach
1 parent 0340713 commit eb97904

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

app/code/Magento/Fedex/Model/Source/Generic.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
/**
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
@@ -9,8 +8,6 @@
98

109
/**
1110
* Fedex generic source implementation
12-
*
13-
* @author Magento Core Team <core@magentocommerce.com>
1411
*/
1512
class Generic implements \Magento\Framework\Data\OptionSourceInterface
1613
{
@@ -44,9 +41,14 @@ public function toOptionArray()
4441
$configData = $this->_shippingFedex->getCode($this->_code);
4542
$arr = [];
4643
if ($configData) {
47-
foreach ($configData as $code => $title) {
48-
$arr[] = ['value' => $code, 'label' => $title];
49-
}
44+
$arr = array_map(
45+
function ($code, $title) {
46+
return [
47+
'value' => $code,
48+
'label' => $title
49+
];
50+
}, array_keys($configData), $configData
51+
);
5052
}
5153

5254
return $arr;

0 commit comments

Comments
 (0)