public function prepareParams($params)
	{
		if (empty($params) || ( ! is_string($params) && ! is_array($params)))
		{
			return [];
		}

		if (is_string($params))
		{
			$new_params = [];
			$separator  = ' ';

			if (strpos($params, ',') !== false)
			{
				$separator = ',';
			}

			$params = explode($separator, $params);
			unset($separator);

			foreach ($params as $p)
			{
				if (! empty($p))
				{
					list($key, $val)        = explode('=', $p);
					$new_params[trim($key)] = trim($val, ', ');
				}
			}

			$params = $new_params;

			unset($new_params);
		}

		if (is_array($params) && empty($params))
		{
			return [];
		}

		return $params;
	}
public function prepareParams($params)
	{
		if (empty($params) || ( ! is_string($params) && ! is_array($params)))
		{
			return [];
		}

		if (is_string($params))
		{
			$new_params = [];
			$separator  = ' ';

			if (strpos($params, ',') !== false)
			{
				$separator = ',';
			}

			$params = explode($separator, $params);
			unset($separator);

			foreach ($params as $p)
			{
				if (! empty($p))
				{
					list($key, $val)        = explode('=', $p);
					$new_params[trim($key)] = trim($val, ', ');
				}
			}

			$params = $new_params;

			unset($new_params);
		}

		if (is_array($params) && empty($params))
		{
			return [];
		}

		return $params;
	}
public function prepareParams ( $ params ) { if ( empty ( $ params ) || ( ! is_string ( $ params ) && ! is_array ( $ params ) ) ) { return [ ] ; } if ( is_string ( $ params ) ) { $ new_params = [ ] ; $ separator = ' ' ; if ( strpos ( $ params , ',' ) !== false ) { $ separator = ',' ; } $ params = explode ( $ separator , $ params ) ; unset ( $ separator ) ; foreach ( $ params as $ p ) { if ( ! empty ( $ p ) ) { list ( $ key , $ val ) = explode ( '=' , $ p ) ; $ new_params [ trim ( $ key ) ] = trim ( $ val , ', ' ) ; } } $ params = $ new_params ; unset ( $ new_params ) ; } if ( is_array ( $ params ) && empty ( $ params ) ) { return [ ] ; } return $ params ; }
Parses the params attribute. If an array, returns untouched.
If a string, it should be in the format "key1=value key2=value".
It will be split and returned as an array.

@param $params

@return array|null
Parses the params attribute . If an array returns untouched . If a string it should be in the format key1 = value key2 = value . It will be split and returned as an array .