Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1046676
D200.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jun 29, 2:28 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Mon, Jun 30, 2:28 AM (6 h, 1 m)
Engine
blob
Format
Raw Data
Handle
676686
Attached To
D200: INP-1537 - Fix CS violations in for "kUtil::array_merge_recursive" method
D200.diff
View Options
Index: branches/5.2.x/core/kernel/globals.php
===================================================================
--- branches/5.2.x/core/kernel/globals.php
+++ branches/5.2.x/core/kernel/globals.php
@@ -56,22 +56,27 @@
* Similar to array_merge_recursive but keyed-valued are always overwritten.
* Priority goes to the 2nd array.
*
- * @param $paArray1 array
- * @param $paArray2 array
+ * @param mixed $array1 Array 1.
+ * @param mixed $array2 Array 2.
+ *
* @return array
- * @access public
*/
- public static function array_merge_recursive($paArray1, $paArray2)
+ public static function array_merge_recursive($array1, $array2)
{
- if (!is_array($paArray1) or !is_array($paArray2)) {
- return $paArray2;
+ if ( !is_array($array1) || !is_array($array2) ) {
+ return $array2;
}
- foreach ($paArray2 AS $sKey2 => $sValue2) {
- $paArray1[$sKey2] = isset($paArray1[$sKey2]) ? self::array_merge_recursive($paArray1[$sKey2], $sValue2) : $sValue2;
+ foreach ( $array2 as $array2_key => $array2_value ) {
+ if ( isset($array1[$array2_key]) ) {
+ $array1[$array2_key] = self::array_merge_recursive($array1[$array2_key], $array2_value);
+ }
+ else {
+ $array1[$array2_key] = $array2_value;
+ }
}
- return $paArray1;
+ return $array1;
}
/**
Event Timeline
Log In to Comment