Commit b795dd8b authored by Carsten  Rose's avatar Carsten Rose
Browse files

onArray: enhanced phpdoc. Extended toString() with 'encloseValue'

parent a4cddb3e
......@@ -18,16 +18,22 @@ require_once(__DIR__ . '/../../qfq/Constants.php');
class OnArray {
/**
* Builds a string from an assoc array.
*
* key/value are combined with $keyValueGlue.
* values are enclosed by $encloseValue.
* rows combined with $rowGlue
*
* @param array $dataArray
* @param string $keyValueGlue
* @param string $rowGlue
* @return string
*/
public static function toString(array $dataArray, $keyValueGlue = '=', $rowGlue = '&') {
public static function toString(array $dataArray, $keyValueGlue = '=', $rowGlue = '&', $encloseValue = '') {
$dataString = '';
foreach ($dataArray as $key => $value) {
$dataString .= $key . $keyValueGlue . $value . $rowGlue;
$dataString .= $key . $keyValueGlue . $encloseValue . $value . $encloseValue . $rowGlue;
}
$glueLength = strlen($rowGlue);
......@@ -86,4 +92,5 @@ class OnArray {
}
return $result;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment