public static function normalize($list, $assoc = true, $sep = ',', $trim = true) {
		if (is_string($list)) {
			$list = explode($sep, $list);
			$list = ($trim) ? array_map('trim', $list) : $list;
			return ($assoc) ? static::normalize($list) : $list;
		}

		if (!is_array($list)) {
			return $list;
		}

		$keys = array_keys($list);
		$count = count($keys);
		$numeric = true;

		if (!$assoc) {
			for ($i = 0; $i < $count; $i++) {
				if (!is_int($keys[$i])) {
					$numeric = false;
					break;
				}
			}
		}

		if (!$numeric || $assoc) {
			$newList = [];
			for ($i = 0; $i < $count; $i++) {
				if (is_int($keys[$i]) && is_scalar($list[$keys[$i]])) {
					$newList[$list[$keys[$i]]] = null;
				} else {
					$newList[$keys[$i]] = $list[$keys[$i]];
				}
			}
			$list = $newList;
		}
		return $list;
	}
public static function normalize($list, $assoc = true, $sep = ',', $trim = true) {
		if (is_string($list)) {
			$list = explode($sep, $list);
			$list = ($trim) ? array_map('trim', $list) : $list;
			return ($assoc) ? static::normalize($list) : $list;
		}

		if (!is_array($list)) {
			return $list;
		}

		$keys = array_keys($list);
		$count = count($keys);
		$numeric = true;

		if (!$assoc) {
			for ($i = 0; $i < $count; $i++) {
				if (!is_int($keys[$i])) {
					$numeric = false;
					break;
				}
			}
		}

		if (!$numeric || $assoc) {
			$newList = [];
			for ($i = 0; $i < $count; $i++) {
				if (is_int($keys[$i]) && is_scalar($list[$keys[$i]])) {
					$newList[$list[$keys[$i]]] = null;
				} else {
					$newList[$keys[$i]] = $list[$keys[$i]];
				}
			}
			$list = $newList;
		}
		return $list;
	}
public static function normalize ( $ list , $ assoc = true , $ sep = ',' , $ trim = true ) { if ( is_string ( $ list ) ) { $ list = explode ( $ sep , $ list ) ; $ list = ( $ trim ) ? array_map ( 'trim' , $ list ) : $ list ; return ( $ assoc ) ? static :: normalize ( $ list ) : $ list ; } if ( ! is_array ( $ list ) ) { return $ list ; } $ keys = array_keys ( $ list ) ; $ count = count ( $ keys ) ; $ numeric = true ; if ( ! $ assoc ) { for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { if ( ! is_int ( $ keys [ $ i ] ) ) { $ numeric = false ; break ; } } } if ( ! $ numeric || $ assoc ) { $ newList = [ ] ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { if ( is_int ( $ keys [ $ i ] ) && is_scalar ( $ list [ $ keys [ $ i ] ] ) ) { $ newList [ $ list [ $ keys [ $ i ] ] ] = null ; } else { $ newList [ $ keys [ $ i ] ] = $ list [ $ keys [ $ i ] ] ; } } $ list = $ newList ; } return $ list ; }
Normalizes a string or array list.

```
Set::normalize('foo,bar'); // returns ['foo' => null, 'bar' => null];
Set::normalize(['foo', 'bar' => 'baz']; // returns ['foo' => null, 'bar' => 'baz'];
```

@param string|array $list List to normalize.
@param boolean $assoc If `true`, `$list` will be converted to an associative array.
@param string $sep If `$list` is a string, it will be split into an array with `$sep`.
@param boolean $trim If `true`, separated strings will be trimmed.
@return array
Normalizes a string or array list .