JSONReader
extends Reader
in package
A JSON Reader, storage using json files, as defined in Reader.
Table of Contents
- $data : mixed
- $datahash : mixed
- $filehandler : mixed
- $filepath : mixed
- $writeable : mixed
- __construct() : mixed
- Creates a JSON Reader, opens and imports file if files exists.
- __destruct() : mixed
- Write file contents on exit, if file changed
- deleteFile() : bool
- Deletes a JSON file. (needs exclusive rights)
- getArray() : array<string|int, mixed>
- getValue() : mixed
- isValue() : bool
- searchValue() : mixed
- setArray() : bool
- setValue() : bool
- setValueHelper() : mixed
- write_content() : successful
- Write file contents, if file writeable and changed
Properties
$data
private
mixed
$data
$datahash
private
mixed
$datahash
$filehandler
private
mixed
$filehandler
$filepath
private
mixed
$filepath
$writeable
private
mixed
$writeable
Methods
__construct()
Creates a JSON Reader, opens and imports file if files exists.
public
__construct( $filename[, $lockex = false ][, $otherpath = '' ]) : mixed
else creates a new file. Opens parent::$path/$filename, $filename contain a folder and a file (parent::$path/myfolder/myfile). Then myfolder has to be created before!
Parameters
- $filename :
-
the filename, without .json
- $lockex : = false
-
lock the file exclusive, if yo
- $otherpath : = ''
-
use another path than parent::$path
Return values
mixed —__destruct()
Write file contents on exit, if file changed
public
__destruct() : mixed
Return values
mixed —deleteFile()
Deletes a JSON file. (needs exclusive rights)
public
static deleteFile(string $name) : bool
Parameters
- $name : string
Return values
bool —getArray()
public
getArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —getValue()
public
getValue(array<string|int, mixed> $index[, bool $exception = false ]) : mixed
Parameters
- $index : array<string|int, mixed>
- $exception : bool = false
Return values
mixed —isValue()
public
isValue(array<string|int, mixed> $index[, mixed $value = null ]) : bool
Parameters
- $index : array<string|int, mixed>
- $value : mixed = null
Return values
bool —searchValue()
public
searchValue(mixed $index, mixed $value[, mixed $column = null ]) : mixed
Parameters
- $index : mixed
- $value : mixed
- $column : mixed = null
Return values
mixed —setArray()
public
setArray(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
Return values
bool —setValue()
public
setValue(array<string|int, mixed> $index, mixed $value) : bool
Parameters
- $index : array<string|int, mixed>
- $value : mixed
Return values
bool —setValueHelper()
private
setValueHelper(mixed $index, mixed $value, mixed $data) : mixed
Parameters
- $index : mixed
- $value : mixed
- $data : mixed
Return values
mixed —write_content()
Write file contents, if file writeable and changed
private
write_content() : successful
Return values
successful —written?