|
|
@ -29,7 +29,7 @@ class JsonManipulator
|
|
|
|
if (!preg_match('#^\{(.*)\}$#s', $contents)) {
|
|
|
|
if (!preg_match('#^\{(.*)\}$#s', $contents)) {
|
|
|
|
throw new \InvalidArgumentException('The json file must be an object ({})');
|
|
|
|
throw new \InvalidArgumentException('The json file must be an object ({})');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->newline = false !== strpos("\r\n", $contents) ? "\r\n": "\n";
|
|
|
|
$this->newline = false !== strpos($contents, "\r\n") ? "\r\n": "\n";
|
|
|
|
$this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
|
|
|
|
$this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
|
|
|
|
$this->detectIndenting();
|
|
|
|
$this->detectIndenting();
|
|
|
|
}
|
|
|
|
}
|
|
|
|