diff options
author | Mate Bartus <mate.bartus@gmail.com> | 2015-07-26 23:00:40 +0200 |
---|---|---|
committer | Mate Bartus <mate.bartus@gmail.com> | 2015-07-26 23:00:40 +0200 |
commit | 11dfe503aac699b88a333967a1d0e594998414ae (patch) | |
tree | fdd1d6d3e1dd913553a5f5f6fda5ae659ad61fec /phpBB/phpbb/install/helper | |
parent | 495c0c6fb32ac0b720fccfeb640a0b3d5a32b98f (diff) | |
download | forums-11dfe503aac699b88a333967a1d0e594998414ae.tar forums-11dfe503aac699b88a333967a1d0e594998414ae.tar.gz forums-11dfe503aac699b88a333967a1d0e594998414ae.tar.bz2 forums-11dfe503aac699b88a333967a1d0e594998414ae.tar.xz forums-11dfe503aac699b88a333967a1d0e594998414ae.zip |
[ticket/13740] Reduce number of references in nav provider
PHPBB3-13740
Diffstat (limited to 'phpBB/phpbb/install/helper')
-rw-r--r-- | phpBB/phpbb/install/helper/navigation/navigation_provider.php | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/phpBB/phpbb/install/helper/navigation/navigation_provider.php b/phpBB/phpbb/install/helper/navigation/navigation_provider.php index 1f58cbea83..d52aec8999 100644 --- a/phpBB/phpbb/install/helper/navigation/navigation_provider.php +++ b/phpBB/phpbb/install/helper/navigation/navigation_provider.php @@ -58,7 +58,7 @@ class navigation_provider public function register(navigation_interface $navigation) { $nav_arry = $navigation->get(); - $this->merge($nav_arry, $this->menu_collection); + $this->menu_collection = $this->merge($nav_arry, $this->menu_collection); } /** @@ -79,7 +79,7 @@ class navigation_provider $array_pointer = $property_array; - $this->merge($array_root_pointer, $this->menu_collection); + $this->menu_collection = $this->merge($array_root_pointer, $this->menu_collection); } /** @@ -90,26 +90,32 @@ class navigation_provider * * @param array $array_to_merge * @param array $array_to_merge_into + * + * @return array Merged array */ - private function merge(&$array_to_merge, &$array_to_merge_into) + private function merge($array_to_merge, $array_to_merge_into) { + $merged_array = $array_to_merge_into; + foreach ($array_to_merge as $key => $value) { if (isset($array_to_merge_into[$key])) { if (is_array($array_to_merge_into[$key]) && is_array($value)) { - $this->merge($value, $array_to_merge_into[$key]); + $merged_array[$key] = $this->merge($value, $array_to_merge_into[$key]); } else { - $array_to_merge_into[$key] = $value; + $merged_array[$key] = $value; } } else { - $array_to_merge_into[$key] = $value; + $merged_array[$key] = $value; } } + + return $merged_array; } } |