\Reader

Reader class to define the api of a reader and/ or writer.

A index is a array of json keys: { "a" : { "b" : 12 } } ["a", "b"] => 12

Summary

Methods
Properties
Constants
changePath()
deleteFile()
getArray()
setArray()
output()
isValue()
getValue()
searchValue()
setValue()
No public properties found
No constants found
No protected methods found
$path
N/A
No private methods found
No private properties found
N/A

Properties

$path

$path : 

Path where the JSON files are located, in redis used as key prefix

Type

Methods

changePath()

changePath(  $path = '') : \the

Changes the data path, the path on filesystem

Parameters

$path

the new path (optional)

Returns

\the —

current path

deleteFile()

deleteFile(  $name) : \deleted?

Deletes a storage storage file

Parameters

$name

file to delete

Returns

\deleted?

getArray()

getArray() : \the

Returns the array of this dataset

Returns

\the —

array

setArray()

setArray(array  $data) : \successful

Sets the array of this dataset

Parameters

array $data

Returns

\successful —

changed?

output()

output() 

Print the array

isValue()

isValue(  $index,   $value = null) : \$value

Checks if a key has a value.

Parameters

$index

array of indexes, the index

$value

the value need at index

Returns

\$value —

and value at $index matches, or $index exists

getValue()

getValue(  $index,   $exception = false) : \the

Fetch a value by the index

Parameters

$index

the array of indexes, the index

$exception

throw an exception if index not found, or return false (optional)

Returns

\the —

value or false

searchValue()

searchValue(  $index,   $value,   $column = null) : \like

Search a value.

Parameters

$index

$index the array of indexes, the index

$value

the value to search

$column

search a colum, name here or null (optional)

Returns

\like —

array_search(), the first found index or false

setValue()

setValue(  $index,   $value) 

Set a value.

Parameters

$index

array of indexes, the index

$value

the value to set