✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ premium290.web-hosting.com ​🇻​♯➤ 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2025

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 63.250.38.37 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.217.165
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/tdhomesa/public_html/wp-content/plugins/woocommerce/src/Internal/Utilities//ArrayUtil.php
<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\Internal\Utilities;

/**
 * A class of utilities for dealing with arrays.
 */
class ArrayUtil {

	/**
	 * Determines if the given array is a list.
	 *
	 * An array is considered a list if its keys consist of consecutive numbers from 0 to count($array)-1.
	 *
	 * Polyfill for array_is_list() in PHP 8.1.
	 *
	 * @param array $arr The array being evaluated.
	 *
	 * @return bool True if array is a list, false otherwise.
	 */
	public static function array_is_list( array $arr ): bool {
		if ( function_exists( 'array_is_list' ) ) {
			return array_is_list( $arr );
		}

		if ( ( array() === $arr ) || ( array_values( $arr ) === $arr ) ) {
			return true;
		}

		$next_key = -1;

		foreach ( $arr as $k => $v ) {
			if ( ++$next_key !== $k ) {
				return false;
			}
		}

		return true;
	}

	/**
	 * Merge two lists of associative arrays by a key.
	 *
	 * @param array  $arr1 The first array.
	 * @param array  $arr2 The second array.
	 * @param string $key  The key to merge by.
	 *
	 * @return array The merged list sorted by the key values.
	 */
	public static function merge_by_key( array $arr1, array $arr2, string $key ): array {
		$merged = array();
		// Overwrite items in $arr1 with items in $arr2 if they have the same key entry value.
		// The rest of items in $arr1 will be appended.
		foreach ( $arr1 as $item1 ) {
			$found = false;
			foreach ( $arr2 as $item2 ) {
				if ( $item1[ $key ] === $item2[ $key ] ) {
					$merged[] = array_merge( $item1, $item2 );
					$found    = true;
					break;
				}
			}
			if ( ! $found ) {
				$merged[] = $item1;
			}
		}

		// Append items from $arr2 that are don't have a corresponding key entry value in $arr1.
		foreach ( $arr2 as $item2 ) {
			$found = false;
			foreach ( $arr1 as $item1 ) {
				if ( $item1[ $key ] === $item2[ $key ] ) {
					$found = true;
					break;
				}
			}
			if ( ! $found ) {
				$merged[] = $item2;
			}
		}

		// Sort the merged list by the key values.
		usort(
			$merged,
			function ( $a, $b ) use ( $key ) {
				return $a[ $key ] <=> $b[ $key ];
			}
		);

		return array_values( $merged );
	}

	/**
	 * Recursively filters null values from an array.
	 *
	 * This method removes all null values from the array, including nested arrays.
	 * Array keys are preserved for associative arrays. For lists (sequential numeric
	 * keys starting from 0), the array is reindexed to maintain the list structure.
	 *
	 * @param array $arr The array to filter.
	 *
	 * @return array The filtered array with null values removed.
	 */
	public static function filter_null_values_recursive( array $arr ): array {
		$is_list  = self::array_is_list( $arr );
		$filtered = array();

		foreach ( $arr as $key => $value ) {
			// Skip null values.
			if ( is_null( $value ) ) {
				continue;
			}

			// Recursively filter nested arrays.
			if ( is_array( $value ) ) {
				$filtered[ $key ] = self::filter_null_values_recursive( $value );
			} else {
				$filtered[ $key ] = $value;
			}
		}

		// Reindex if the original array was a list.
		return $is_list ? array_values( $filtered ) : $filtered;
	}
}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
28 May 2026 10.38 AM
tdhomesa / tdhomesa
0755
ArrayUtil.php
3.065 KB
24 Nov 2025 11.10 PM
tdhomesa / tdhomesa
0644
BlocksUtil.php
2.358 KB
26 Jan 2026 10.40 AM
tdhomesa / tdhomesa
0644
COTMigrationUtil.php
6.037 KB
12 May 2025 9.07 PM
tdhomesa / tdhomesa
0644
DatabaseUtil.php
16.097 KB
23 Sep 2024 8.44 PM
tdhomesa / tdhomesa
0644
FilesystemUtil.php
7.628 KB
30 Mar 2026 5.12 PM
tdhomesa / tdhomesa
0644
HtmlSanitizer.php
3.097 KB
30 Apr 2024 7.35 PM
tdhomesa / tdhomesa
0644
LegacyRestApiStub.php
6.647 KB
18 Dec 2024 10.19 PM
tdhomesa / tdhomesa
0644
PluginInstaller.php
14.011 KB
18 Dec 2024 10.19 PM
tdhomesa / tdhomesa
0644
ProductUtil.php
1.164 KB
6 Oct 2025 5.56 PM
tdhomesa / tdhomesa
0644
Types.php
1.973 KB
16 Dec 2024 3.24 PM
tdhomesa / tdhomesa
0644
URL.php
13.104 KB
16 Dec 2024 3.24 PM
tdhomesa / tdhomesa
0644
URLException.php
0.187 KB
20 Apr 2022 6.50 AM
tdhomesa / tdhomesa
0644
Users.php
9.474 KB
23 Feb 2026 5.58 PM
tdhomesa / tdhomesa
0644
WebhookUtil.php
5.368 KB
18 Dec 2024 10.19 PM
tdhomesa / tdhomesa
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF