X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FArray.php;h=5ecdb554d58b29b404cecba3f84c0c40ff8caf90;hb=d2c8abd4350590e07973855ce2bccb3d3ff9780e;hp=c6eaec21998762cf690f66129d4d9568623d5172;hpb=2e1f50d6c1bd31b78fa97d1e899d4ae01a2cfd3d;p=civicrm-core.git diff --git a/CRM/Utils/Array.php b/CRM/Utils/Array.php index c6eaec2199..5ecdb554d5 100644 --- a/CRM/Utils/Array.php +++ b/CRM/Utils/Array.php @@ -119,26 +119,26 @@ class CRM_Utils_Array { * The array to be serialized. * @param int $depth * (optional) Indentation depth counter. - * @param string $seperator + * @param string $separator * (optional) String to be appended after open/close tags. * * @return string * XML fragment representing $list. */ - public static function &xml(&$list, $depth = 1, $seperator = "\n") { + public static function &xml(&$list, $depth = 1, $separator = "\n") { $xml = ''; foreach ($list as $name => $value) { $xml .= str_repeat(' ', $depth * 4); if (is_array($value)) { - $xml .= "<{$name}>{$seperator}"; - $xml .= self::xml($value, $depth + 1, $seperator); + $xml .= "<{$name}>{$separator}"; + $xml .= self::xml($value, $depth + 1, $separator); $xml .= str_repeat(' ', $depth * 4); - $xml .= "{$seperator}"; + $xml .= "{$separator}"; } else { // make sure we escape value $value = self::escapeXML($value); - $xml .= "<{$name}>$value{$seperator}"; + $xml .= "<{$name}>$value{$separator}"; } } return $xml; @@ -218,14 +218,14 @@ class CRM_Utils_Array { * Destination array. * @param string $prefix * (optional) String to prepend to keys. - * @param string $seperator + * @param string $separator * (optional) String that separates the concatenated keys. */ - public static function flatten(&$list, &$flat, $prefix = '', $seperator = ".") { + public static function flatten(&$list, &$flat, $prefix = '', $separator = ".") { foreach ($list as $name => $value) { - $newPrefix = ($prefix) ? $prefix . $seperator . $name : $name; + $newPrefix = ($prefix) ? $prefix . $separator . $name : $name; if (is_array($value)) { - self::flatten($value, $flat, $newPrefix, $seperator); + self::flatten($value, $flat, $newPrefix, $separator); } else { $flat[$newPrefix] = $value; @@ -915,7 +915,7 @@ class CRM_Utils_Array { foreach ($matrix as $pos => $oldRow) { $newRow = []; foreach ($columns as $column) { - $newRow[$column] = CRM_Utils_Array::value($column, $oldRow); + $newRow[$column] = $oldRow[$column] ?? NULL; } $newRows[$pos] = $newRow; }