Yoast/Sniffs/Files/FileNameSniff.php
protected function clean_custom_array_property( $property, $flip = false, $to_lower = false ) {
		if ( is_bool( $property ) ) {
			// Allow for resetting in the unit tests.
			return array();
		}

		if ( is_string( $property ) ) {
			$property = explode( ',', $property );
		}

		$property = array_filter( array_map( 'trim', $property ) );

		if ( true === $to_lower ) {
			$property = array_map( 'strtolower', $property );
		}

		if ( true === $flip ) {
			$property = array_fill_keys( $property, false );
		}

		return $property;
	}
protected function clean_custom_array_property( $property, $flip = false, $to_lower = false ) {
		if ( is_bool( $property ) ) {
			// Allow for resetting in the unit tests.
			return array();
		}

		if ( is_string( $property ) ) {
			$property = explode( ',', $property );
		}

		$property = array_filter( array_map( 'trim', $property ) );

		if ( true === $to_lower ) {
			$property = array_map( 'strtolower', $property );
		}

		if ( true === $flip ) {
			$property = array_fill_keys( $property, false );
		}

		return $property;
	}
protected function clean_custom_array_property ( $ property , $ flip = false , $ to_lower = false ) { if ( is_bool ( $ property ) ) { // Allow for resetting in the unit tests. return array ( ) ; } if ( is_string ( $ property ) ) { $ property = explode ( ',' , $ property ) ; } $ property = array_filter ( array_map ( 'trim' , $ property ) ) ; if ( true === $ to_lower ) { $ property = array_map ( 'strtolower' , $ property ) ; } if ( true === $ flip ) { $ property = array_fill_keys ( $ property , false ) ; } return $ property ; }
Clean a custom array property received from a ruleset.

Deals with incorrectly passed custom array properties.
- If the property was passed as a string, change it to an array.
- Remove whitespace surrounding values.
- Remove empty array entries.

Optionally flips the array to allow for using `isset` instead of `in_array`.

@param mixed $property The current property value.
@param bool  $flip     Whether to flip the array values to keys.
@param bool  $to_lower Whether to lowercase the array values.

@return array
Clean a custom array property received from a ruleset .