Commit 446165d0 authored by Carsten  Rose's avatar Carsten Rose
Browse files

KeyValueStringParser.php: added ';' as additional comment sign

parent 858a462a
......@@ -27,9 +27,9 @@ require_once(__DIR__ . '/../exceptions/UserException.php');
* id=1,name=doe,firstname=john
*
* - Leading and trailing whitespace will be removed from keys and values.
* - If a value is surrounded by quotes (`'`, * `"`), leading and trailing
* - If a value is surrounded by quotes (`'`, `"`), leading and trailing
* whitespace will be preserved (leading/trailing, quotes will be removed from value).
* - Comments, lines starting with a '#', will be skipped.
* - Comments, lines starting with a '#' or ';', will be skipped.
*
* @package qfq
*/
......@@ -148,7 +148,7 @@ class KeyValueStringParser {
$key = trim($keyValueArray[0]);
// skip comments
if (substr($key, 0, 1) == '#') {
if (substr($key, 0, 1) == '#' || substr($key, 0, 1) == ';') {
continue;
}
......
......@@ -108,7 +108,7 @@ class KeyValueStringParserTest extends \PHPUnit_Framework_TestCase {
}
public function testComments() {
$actual = $this->keyValueStringParser->parse(" key1 : val:ue1 , # key2 : value2 , # : broken key value in comment, key3 : valid ");
$actual = $this->keyValueStringParser->parse(" key1 : val:ue1 , # key2 : value2 , ; : broken key value in comment, key3 : valid ");
$expected = [
'key1' => 'val:ue1',
......
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