class Database

Constants

FILE_READ

File read flag.

FILE_WRITE

File write flag.

FILE_APPEND

File append flag.

Properties

protected array $fileAccessMode File access mode.
protected string $name Database name.
protected Config $config Config class.

Methods

__construct(string $name, Config $config = null)

Constructor.

string
getName()

Get the database name.

setName(string $name)

Set the database name.

getConfig()

Get the config.

setConfig(Config $config)

Set the config.

string
getPath()

Get the path to the database file.

openFile(int $mode)

Open the database file.

openTempFile()

Open a temporary file.

closeFile(SplFileObject $file)

Close the database file.

readFromFile()

Read lines from the database file.

appendToFile(string $line)

Append a line to the database file.

flushFile()

Flush the database file.

writeTempToFile(SplTempFileObject $tmpFile)

Write temporary file contents to database file.

Details

at line 71
__construct(string $name, Config $config = null)

Constructor.

Parameters

string $name
Config $config

at line 85
string getName()

Get the database name.

Return Value

string

at line 97
setName(string $name)

Set the database name.

Parameters

string $name

Exceptions

Exception

at line 108
Config getConfig()

Get the config.

Return Value

Config

at line 118
setConfig(Config $config)

Set the config.

Parameters

Config $config

at line 128
string getPath()

Get the path to the database file.

Return Value

string

at line 142
protected SplFileObject openFile(int $mode)

Open the database file.

Parameters

int $mode

Return Value

SplFileObject

Exceptions

Exception

at line 178
SplTempFileObject openTempFile()

Open a temporary file.

Return Value

SplTempFileObject

at line 190
protected closeFile(SplFileObject $file)

Close the database file.

Parameters

SplFileObject $file

Exceptions

Exception

at line 205
Generator readFromFile()

Read lines from the database file.

Return Value

Generator

at line 223
appendToFile(string $line)

Append a line to the database file.

Parameters

string $line

at line 233
flushFile()

Flush the database file.

at line 244
writeTempToFile(SplTempFileObject $tmpFile)

Write temporary file contents to database file.

Parameters

SplTempFileObject $tmpFile