public static function toString($data)
    {
        if (is_array($data)) {
            $newData = [];
            foreach ($data as $key => $val) {
                $key = (string)$key;
                $newData[$key] = static::toString($val);
            }
        } else {
            $newData = (string)$data;
        }

        return $newData;
    }
public static function toString($data)
    {
        if (is_array($data)) {
            $newData = [];
            foreach ($data as $key => $val) {
                $key = (string)$key;
                $newData[$key] = static::toString($val);
            }
        } else {
            $newData = (string)$data;
        }

        return $newData;
    }
public static function toString ( $ data ) { if ( is_array ( $ data ) ) { $ newData = [ ] ; foreach ( $ data as $ key => $ val ) { $ key = ( string ) $ key ; $ newData [ $ key ] = static :: toString ( $ val ) ; } } else { $ newData = ( string ) $ data ; } return $ newData ; }
Ensure that the passed parameter is a string, or an array of strings.

@param mixed $data The value to convert to a string

@return string|string[]
Ensure that the passed parameter is a string or an array of strings .