true` format. * * Any custom items will be given the value `false` to be able to * distinguish them from pre-set (base array) values. * * Will filter previously added custom items out from the base array * before merging/returning to allow for resetting to the base array. * * {@internal Function is static as it doesn't use any of the properties or others * methods anyway.} * * @since 0.11.0 * @since 2.0.0 No longer supports custom array properties which were incorrectly * passed as a string. * @since 3.0.0 Moved from the Sniff class to this class. * * @param array $custom Custom list as provided via a ruleset. * @param array $base Optional. Base list. Defaults to an empty array. * Expects `value => true` format when `$flip` is true. * @param bool $flip Optional. Whether or not to flip the custom list. * Defaults to true. * @return array */ public static function merge_custom_array( $custom, array $base = array(), $flip = true ) { if ( true === $flip ) { $base = array_filter( $base ); } if ( empty( $custom ) || ! \is_array( $custom ) ) { return $base; } if ( true === $flip ) { $custom = array_fill_keys( $custom, false ); } if ( empty( $base ) ) { return $custom; } return array_merge( $base, $custom ); } }