1
0
Fork 0

Add support for manipulating empty json files

pull/2353/merge
Jordi Boggiano 2014-05-27 13:59:32 +02:00
parent af6ef235e1
commit 534bd64cd1
1 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,9 @@ class JsonManipulator
}
$contents = trim($contents);
if ($contents === '') {
$contents = '{}';
}
if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
throw new \InvalidArgumentException('The json file must be an object ({})');
}