Configuration
in package
The configuration information for a LotGD game. Configuration is read from a YAML file, who's path is specified when you construct the object.
Table of Contents
- $databaseAutoSchemaUpdate : bool
- $databaseDSN : string
- $databaseName : string
- $databasePassword : string
- $databaseUser : string
- $gameDaysPerDay : int
- $gameEpoch : DateTime
- $gameOffsetSeconds : int
- $logPath : string
- __construct() : mixed
- Create the configuration object, reading from the specified path.
- __toString() : string
- Generate a textual representation of the configuration, for debugging purposes.
- getDatabaseAutoSchemaUpdate() : bool
- True if doctrine should not auto update.
- getDatabaseConnectionDetails() : array<string|int, mixed>
- Returns database connection details needed for pdo to establish a connection.
- getDatabaseDSN() : string
- Return the data source name, a way to describe where the database is. See https://en.wikipedia.org/wiki/Data_source_name.
- getDatabaseName() : string
- Return the database name.
- getDatabasePassword() : string
- Return the database password.
- getDatabaseUser() : string
- Return the database user.
- getGameDaysPerDay() : int
- Return how many game days should exist inside one real time day.
- getGameEpoch() : DateTime
- Return which day, in real time, the game's date should start.
- getGameOffsetSeconds() : int
- Return the offset, in seconds, from the game epoch, to define when the game should start.
- getLogPath() : string
- Return the path to the directory to store log files.
- retrieveRawConfig() : array<string|int, mixed>
- Retrieves raw config via Yaml::parse from a given file.
Properties
$databaseAutoSchemaUpdate
private
bool
$databaseAutoSchemaUpdate
$databaseDSN
private
string
$databaseDSN
$databaseName
private
string
$databaseName
$databasePassword
private
string
$databasePassword
$databaseUser
private
string
$databaseUser
$gameDaysPerDay
private
int
$gameDaysPerDay
$gameEpoch
private
DateTime
$gameEpoch
$gameOffsetSeconds
private
int
$gameOffsetSeconds
$logPath
private
string
$logPath
Methods
__construct()
Create the configuration object, reading from the specified path.
public
__construct(string $configFilePath) : mixed
Parameters
- $configFilePath : string
-
Path to a configuration YAML, relative to the current working directory.
Return values
mixed —__toString()
Generate a textual representation of the configuration, for debugging purposes.
public
__toString() : string
Return values
string —getDatabaseAutoSchemaUpdate()
True if doctrine should not auto update.
public
getDatabaseAutoSchemaUpdate() : bool
Return values
bool —getDatabaseConnectionDetails()
Returns database connection details needed for pdo to establish a connection.
public
getDatabaseConnectionDetails([string $cwd = "" ]) : array<string|int, mixed>
This function takes optionally replaces the string %cwd% in the database dsn and replaces it with the first parameter. This is important to normalize the database location across different working directories. Alternatively, SQLite databse names can also directly be given as an absolute path instead of a relative one.
Parameters
- $cwd : string = ""
-
Current working directory
Return values
array<string|int, mixed> —A list containing the following details: dsn, user, password.
getDatabaseDSN()
Return the data source name, a way to describe where the database is. See https://en.wikipedia.org/wiki/Data_source_name.
public
getDatabaseDSN() : string
Return values
string —The configured data source name.
getDatabaseName()
Return the database name.
public
getDatabaseName() : string
Return values
string —The configured database name.
getDatabasePassword()
Return the database password.
public
getDatabasePassword() : string
Return values
string —The configured database password.
getDatabaseUser()
Return the database user.
public
getDatabaseUser() : string
Return values
string —The configured database user.
getGameDaysPerDay()
Return how many game days should exist inside one real time day.
public
getGameDaysPerDay() : int
Return values
int —getGameEpoch()
Return which day, in real time, the game's date should start.
public
getGameEpoch() : DateTime
Return values
DateTime —getGameOffsetSeconds()
Return the offset, in seconds, from the game epoch, to define when the game should start.
public
getGameOffsetSeconds() : int
Return values
int —getLogPath()
Return the path to the directory to store log files.
public
getLogPath() : string
Return values
string —The configured log directory path.
retrieveRawConfig()
Retrieves raw config via Yaml::parse from a given file.
protected
retrieveRawConfig(string $configFilePath) : array<string|int, mixed>
Parameters
- $configFilePath : string
-
File used to parse with Yaml
Return values
array<string|int, mixed> —Raw config