private static function writeParameter($file_handle, $name, $parameter, $depth = 0)
    {
        if ($depth > 1)
            throw new \DomainException("Cannot nest arrays more than once in INI-file");

        $str = "";
        if (WF::is_array_like($parameter))
        {
            foreach ($parameter as $key => $val)
            {
                $prefix = $name . "[" . $key . "]";
                self::writeParameter($file_handle, $prefix, $val, $depth + 1); 
            }
        }
        elseif (is_bool($parameter))
            fwrite($file_handle, "$name = " . ($parameter ? "true" : "false") . "\n");
        elseif (is_null($parameter))
            fwrite($file_handle, "$name = null\n");
        elseif (is_float($parameter) && WF::is_int_val((string)$parameter))
            fwrite($file_handle, "$name = " . sprintf("%.1f", $parameter) . "\n");
        elseif (is_float($parameter))
            fwrite($file_handle, "$name = " . $parameter . "\n");
        elseif (is_numeric($parameter))
            fwrite($file_handle, "$name = " . $parameter . "\n");
        else
            fwrite($file_handle, "$name = \"" . str_replace('"', '\\"', $parameter) . "\"\n");
    }
private static function writeParameter($file_handle, $name, $parameter, $depth = 0)
    {
        if ($depth > 1)
            throw new \DomainException("Cannot nest arrays more than once in INI-file");

        $str = "";
        if (WF::is_array_like($parameter))
        {
            foreach ($parameter as $key => $val)
            {
                $prefix = $name . "[" . $key . "]";
                self::writeParameter($file_handle, $prefix, $val, $depth + 1); 
            }
        }
        elseif (is_bool($parameter))
            fwrite($file_handle, "$name = " . ($parameter ? "true" : "false") . "\n");
        elseif (is_null($parameter))
            fwrite($file_handle, "$name = null\n");
        elseif (is_float($parameter) && WF::is_int_val((string)$parameter))
            fwrite($file_handle, "$name = " . sprintf("%.1f", $parameter) . "\n");
        elseif (is_float($parameter))
            fwrite($file_handle, "$name = " . $parameter . "\n");
        elseif (is_numeric($parameter))
            fwrite($file_handle, "$name = " . $parameter . "\n");
        else
            fwrite($file_handle, "$name = \"" . str_replace('"', '\\"', $parameter) . "\"\n");
    }
private static function writeParameter ( $ file_handle , $ name , $ parameter , $ depth = 0 ) { if ( $ depth > 1 ) throw new \ DomainException ( "Cannot nest arrays more than once in INI-file" ) ; $ str = "" ; if ( WF :: is_array_like ( $ parameter ) ) { foreach ( $ parameter as $ key => $ val ) { $ prefix = $ name . "[" . $ key . "]" ; self :: writeParameter ( $ file_handle , $ prefix , $ val , $ depth + 1 ) ; } } elseif ( is_bool ( $ parameter ) ) fwrite ( $ file_handle , "$name = " . ( $ parameter ? "true" : "false" ) . "\n" ) ; elseif ( is_null ( $ parameter ) ) fwrite ( $ file_handle , "$name = null\n" ) ; elseif ( is_float ( $ parameter ) && WF :: is_int_val ( ( string ) $ parameter ) ) fwrite ( $ file_handle , "$name = " . sprintf ( "%.1f" , $ parameter ) . "\n" ) ; elseif ( is_float ( $ parameter ) ) fwrite ( $ file_handle , "$name = " . $ parameter . "\n" ) ; elseif ( is_numeric ( $ parameter ) ) fwrite ( $ file_handle , "$name = " . $ parameter . "\n" ) ; else fwrite ( $ file_handle , "$name = \"" . str_replace ( '"' , '\\"' , $ parameter ) . "\"\n" ) ; }
Recursive function that writes a parameter or a series of parameters
to the INI file

@param $name string The name of the parameter
@param $parameter mixed The parameter to write
Recursive function that writes a parameter or a series of parameters to the INI file