Commit 5b3b5128 authored by Carsten  Rose's avatar Carsten Rose
Browse files

KeyValueStringParser: phpdoc

parent 1e907b7d
......@@ -76,18 +76,16 @@ class KeyValueStringParser {
/**
* Parse key/value pairs string and returns them as an assoc array
*
* Valid: "a:1,b:2,c:,d", "," (empty key AND empty value)
* Invalid: ":" ((empty key forbidden)
* $keyValueMode:
* KEY_VALUE_PAIR: default. If only a key is given, the value is ''. E.G. 'a,b' >> [ 'a' => '', 'b' => '' ].
* KEY_VALUE_SINGLE: If only a key is given, the value is the same as the key. E.G. 'a,b' >> [ 'a' => 'a', 'b' => 'b' ].
* Hint $keyValueString: "a:1,b:2,c:,d", "," (empty key AND empty value)
*
* @param string $keyValueString string of key/value pairs
* @param string $keyValueString string of key/value pairs. E.g.: 'a=100,b=test'
* @param string $keyValueDelimiter
* @param string $listDelimiter
* @param string $valueMode
* * VALUE_GIVEN: If only a key is given, the value is ''. E.G. 'a,b' >> [ 'a' => '', 'b' => '' ]
* * IF_VALUE_EMPTY_COPY_KEY: If only a key is given, the value is the same as the key. E.G. 'a,b' >> [ 'a' => 'a', 'b' => 'b' ].
* @return array associative array indexed by keys
* @throws UserException
* @throws UserException Thrown if there is a value but no key.
*/
public static function parse($keyValueString, $keyValueDelimiter = ":", $listDelimiter = ",", $valueMode = VALUE_GIVEN) {
......
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