| Methods |
public
static
|
addToFile(string $path, integer|string $entryKey, mixed $entryValue, boolean $addToTop = false): boolean
Adds a value to an array inside a json file, this does not work with nested arrays.
Adds a value to an array inside a json file, this does not work with nested arrays.
Parameters
| $path |
The path to the json file.
|
| $entryKey |
The new key to add to the json file.
|
| $entryValue |
The new value to put with the key.
|
| $addToTop |
Weather to add it before the existing data or after.
|
Returns
|
#
|
public
static
|
readFile(string $path, boolean $createIfNonexistant = false, mixed $expectedValue = []): mixed
Reads a json file and returns the decoded values.
Reads a json file and returns the decoded values.
Parameters
| $path |
The path to the json file.
|
| $createIfNonexistant |
Weather to create the file if it does not exist.
|
| $expectedValue |
The default value to return and put into the file if it doesnt already exist.
|
Returns
The value stored in the json file or the default value.
|
#
|
public
static
|
writeFile(string $path, mixed $value, boolean $overwrite = false): boolean
Writes a value into a json file.
Writes a value into a json file.
Parameters
| $path |
The path to the json file.
|
| $value |
The value to but into the json file.
|
| $overwrite |
Weather to overwrite any existing file.
|
Returns
|
#
|