Fix minor issues in json code
parent
5f48d5277d
commit
c7ed20e9d8
|
@ -195,7 +195,7 @@ class JsonFile
|
||||||
$buffer = '';
|
$buffer = '';
|
||||||
$noescape = true;
|
$noescape = true;
|
||||||
|
|
||||||
for ($i = 0; $i <= $strLen; $i++) {
|
for ($i = 0; $i < $strLen; $i++) {
|
||||||
// Grab the next character in the string
|
// Grab the next character in the string
|
||||||
$char = substr($json, $i, 1);
|
$char = substr($json, $i, 1);
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue