Skip to content

Commit 9b2cdf6

Browse files
authored
Optimized Varien_Object::_addFullNames() (#2821)
1 parent 9e6ac30 commit 9b2cdf6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/Varien/Object.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,13 @@ public function __construct()
111111

112112
protected function _addFullNames()
113113
{
114-
$existedShortKeys = array_intersect($this->_syncFieldsMap, array_keys($this->_data));
115-
if (!empty($existedShortKeys)) {
116-
foreach ($existedShortKeys as $key) {
117-
$fullFieldName = array_search($key, $this->_syncFieldsMap);
118-
$this->_data[$fullFieldName] = $this->_data[$key];
119-
}
114+
if (empty($this->_syncFieldsMap)) {
115+
return;
116+
}
117+
118+
$existedShortKeys = array_intersect_key(array_flip($this->_syncFieldsMap), $this->_data);
119+
foreach ($existedShortKeys as $key => $fullFieldName) {
120+
$this->_data[$fullFieldName] = $this->_data[$key];
120121
}
121122
}
122123

0 commit comments

Comments
 (0)