The WebAbility® Network Developers - Documentation
WebAbility Site
\xconfig\XConfig reference

I. Structure:


- namespace:
\xconfig\

- Direct superclass:
none

- Direct known subclasses:
none

- Implements:
\ArrayAccess
\Iterator
\Countable

II. Description:


This is the class to import, compile and export a configuration file (see full configuration reference)

III. Reference:


3.1. Contructor:


\xconfig\XConfig($data, $default)
Creates the instance and load the configuration data.
If $data is a string, the object will automatically compile the source variables in memory.
If $data is an array, it will copy each of the array entry as variables in memory
  • $data: mixed: if string, the raw config file. If array, a set of parameter-values pairs
  • $default: null or array: the default parameter-values pairs for if an entry does not exists in the data


3.2. Constants:

VERSION
The version of the library


3.3. Attributes:


public static string $NEWLINE
Is used to store the line break string that may vary to compile the configuration string

protected array $entries
Is used to store the parameter-values pairs.


3.4. Methods:


public void merge()
This method is used to return the ID of the loaded language table.

public string getArray()
This method is used to return the language of the loaded language table.

public void setArray($id, $data)
This method is used to set an entry in the language table. If the entry already exists, it will be overwritten. If not, it will be created.
  • $id: string, the unique identificator of the entry into the language table.
  • $data: string, the value of the language entry.

public void compile($id)
This method is used to delete an entry from the language table. If the entry does not exists, nothing happen.
  • $id: string, the unique identificator of the entry into the language table.

public string create($id)
This method is used to get an entry in the language table. If the entry exists, it will return the value. If not, it will return the same $id.
  • $id: string, the unique identificator of the entry into the language table.