Tokens::remove_duplicate_token_ids( $tokens )


Parameters Parameters

$tokens

(Required)


Top ↑

Return Return

(array|mixed)


Source Source

File: src/core/lib/recipe-parts/trait-tokens.php

	public static function remove_duplicate_token_ids( $tokens ) {
		$new_tokens = array();
		if ( empty( $tokens ) ) {
			return $tokens;
		}
		foreach ( $tokens as $token ) {
			if ( ! array_key_exists( $token['tokenId'], $new_tokens ) ) {
				$new_tokens[ $token['tokenId'] ] = $token;
			}
		}

		return array_values( $new_tokens );
	}