This class provides the interface for writers of configuration objects of type ezcConfiguration.
The writer will serialize the data to a given format e.g. to an INI file or a given XML format which can later be read by a ezcConfigurationReader.
The writer is meant to be initialized with setLocation() and setConfig() and then a call to save(). It is also possible to initialize everything with the init() function.
Source for this file: /Configuration/src/interfaces/writer.php
Version: | //autogen// |
Child Class | Description |
---|---|
ezcConfigurationFileWriter | ezcConfigurationFileWriter class provides the functionality for writing file based configuration formats. |
public abstract string |
getLocation(
)
Returns the current location string. |
public abstract string |
getName(
)
Returns the current name for the configuration to be written. |
public abstract array |
getOptions(
)
Returns the current options for the writer. |
protected abstract string |
getSuffix(
)
Returns the suffix used in the storage filename. |
public abstract void |
init(
$location
, $name
, $config
, [ $options
= array()] )
Initializes the writer with a $location and a $name. |
public abstract void |
save(
)
Saves the current config object. |
public abstract void |
setConfig(
$config
)
Sets the configuration object that will be used for the next call to save(). |
public abstract void |
setOptions(
$options
)
Sets the options for the writer. |
Returns the current location string.
Method | Description |
---|---|
ezcConfigurationFileWriter::getLocation() |
Return the current location string. |
Returns the current name for the configuration to be written.
Method | Description |
---|---|
ezcConfigurationFileWriter::getName() |
Return the current name for the configuration to be written. |
Returns the current options for the writer.
Method | Description |
---|---|
ezcConfigurationFileWriter::getOptions() |
Returns the current options for the writer. |
Returns the suffix used in the storage filename.
Method | Description |
---|---|
ezcConfigurationArrayWriter::getSuffix() |
Returns the suffix used in the storage filename. |
ezcConfigurationIniWriter::getSuffix() |
Returns 'ini'. The suffix used in the storage filename. |
Initializes the writer with a $location and a $name.
These values determine where the configuration will be serialized.
The location string can be used to determine the directory location for an INI file.
The name parameter can be the basename for the INI file, so a value of 'site' would create a file with name 'site.ini'.
Name | Type | Description |
---|---|---|
$location |
string | The main placement for the configuration. It is up to the specific writer to interpret this value. |
$name |
string | The name for the configuration. It is up to the specific writer to interpret this value. For a file writer it could be the basename for the INI file, so a value of 'site' would create a file with name 'site.ini'. |
$config |
ezcConfiguration | The current configuration object which should be serialized by the current writer. |
$options |
array | An associative array of options for the writer. Which options to use is determined by the specific writer class. |
Method | Description |
---|---|
ezcConfigurationFileWriter::init() |
Initializes the writer with a $location and a $name. |
Saves the current config object.
The configuration retrieved later with a ezcConfigurationReader.
Type | Description |
---|---|
ezcConfigurationReadFailedException |
if the configuration could not be written to the given location. |
ezcConfigurationNoConfigException |
if there is no config object set to be written to the location. |
ezcConfigurationInvalidSuffixException |
if the current location values cannot be used for writing. |
Method | Description |
---|---|
ezcConfigurationFileWriter::save() |
Saves the current config object. |
Sets the configuration object that will be used for the next call to save().
Pass false if you wish to remove the current configuration object.
Name | Type | Description |
---|---|---|
$config |
ezcConfiguration |
Method | Description |
---|---|
ezcConfigurationFileWriter::setConfig() |
Sets the configuration object that will be used for the next call to save(). |
Sets the options for the writer.
The options will be used the next time the save() method is called. The $options array is an associative array with the options for the writer. It depends on the specific writer which options are allowed here.
Name | Type | Description |
---|---|---|
$options |
array |
Method | Description |
---|---|
ezcConfigurationFileWriter::setOptions() |
Sets the options $configurationData. |