\App\CoreModule\ModelsJsonFileManager

Tool for reading and writing JSON files

Summary

Methods
Properties
Constants
__construct()
getDirectory()
delete()
exists()
read()
write()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct(  configDir) : 

Constructor

Parameters

configDir

Directory with configuration files

Returns

getDirectory()

getDirectory() : 

Return the directory with files

Returns

Directory with files

delete()

delete(  fileName) : 

Delete a JSON file

Parameters

fileName

File name

Returns

exists()

exists(  fileName) : 

Check if file exists

Parameters

fileName

File name

Returns

Is file exists?

read()

read(  fileName) : mixed||string|int

Read JSON file and decode JSON to array

Parameters

fileName

File name (without .json)

Throws

\App\CoreModule\Models\JsonException

Returns

mixed||string|int —

JSON data in array

write()

write(  name, mixed||string|int  array) : 

Encode JSON from array and write the JSON file

Parameters

name

File name (without .json)

mixed||string|int array

JSON data in array

Throws

\App\CoreModule\Models\JsonException

Returns