\MiotApi\Util\JsonerJsonLoader

Summary

Methods
Properties
Constants
dataToFile()
arrayToFile()
fileToArray()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
createDirectory()
saveFile()
No private properties found
N/A

Methods

dataToFile()

dataToFile(string  $data, string  $file) : array

Creating JSON file from data.

Parameters

string $data

→ JSON data

string $file

→ path to the file

Throws

\MiotApi\Exception\JsonException

Returns

array

arrayToFile()

arrayToFile(array  $array, string  $file) : array

Creating JSON file from array.

Parameters

array $array

→ array to be converted to JSON

string $file

→ path to the file

Throws

\MiotApi\Exception\JsonException

Returns

array

fileToArray()

fileToArray(string  $file) : array|false

Save to array the JSON file content.

Parameters

string $file

→ path or external url to JSON file

Throws

\MiotApi\Exception\JsonException

Returns

array|false

createDirectory()

createDirectory(string  $file) 

Create directory recursively if it doesn't exist.

Parameters

string $file

→ path to the directory

Throws

\MiotApi\Exception\JsonException

→ couldn't create directory

saveFile()

saveFile(string  $file, string  $json) 

Save file.

Parameters

string $file

→ path to the file

string $json

→ json string

Throws

\MiotApi\Exception\JsonException

→ couldn't create file