Path

ez components / documentation / api reference / 2007.2beta1 / configuration


eZ Components 2007.2beta1

Configuration: ezcConfigurationArrayWriter

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcConfigurationArrayWriter

This class provides functionality for writing ezcConfiguration object into files containing PHP arrays. [source]
The file it writes to will be a PHP file containing the group and comments (if enabled).
A typical usage is to create the writer object and pass the filepath in the constructor:
1.  $writer new ezcConfigurationArrayWriter"settings/site.php" );
2.  $writer->setConfig$configurationObject );
3.  $writer->save();
That makes the class figure out the location and name values automatically.
Or generally use the init() function:
1.  $writer new ezcConfigurationArrayWriter();
2.  $writer->init"settings""site"$configurationObject );
3.  $writer->save();
For more information on file based configurations see ezcConfigurationFileWriter.
This class uses exceptions and will throw them when the conditions for the operation fails somehow.
Files are required to have the suffix .php, as this allows PHP accelerators to cache the content for even faster retrieval.

Parents

ezcConfigurationWriter
   |
   --ezcConfigurationFileWriter
      |
      --ezcConfigurationArrayWriter

Inherited Member Variables

From ezcConfigurationFileWriter:
protected  ezcConfigurationFileWriter::$config
protected  ezcConfigurationFileWriter::$location
protected  ezcConfigurationFileWriter::$name
protected  ezcConfigurationFileWriter::$options
protected  ezcConfigurationFileWriter::$path
protected  ezcConfigurationFileWriter::$permissions
protected  ezcConfigurationFileWriter::$useComments

Method Summary

protected string getSuffix( )
Returns the suffix used in the storage filename.
protected static void writeSettings( $fp, $settings, [$comments = array()] )
Writes the settings and comments to disk

Inherited Methods

From ezcConfigurationFileWriter :
public ezcConfigurationFileWriter ezcConfigurationFileWriter::__construct()
Constructs the writer and initializes it with the file to write.
protected void ezcConfigurationFileWriter::closeFile()
Closes a file pointed to by $fp and sets file permissions.
public string ezcConfigurationFileWriter::getLocation()
Return the current location string.
public int ezcConfigurationFileWriter::getName()
Return the current name for the configuration to be written.
public array ezcConfigurationFileWriter::getOptions()
Returns the current options for the writer.
public void ezcConfigurationFileWriter::init()
Initializes the writer with a $location and a $name.
protected resource ezcConfigurationFileWriter::openFile()
Opens a file for writing.
protected void ezcConfigurationFileWriter::parseLocationPath()
Parses a the path $path and sets the location and name properties on this object.
public void ezcConfigurationFileWriter::save()
Saves the current config object.
public void ezcConfigurationFileWriter::setConfig()
Sets the configuration object that will be used for the next call to save().
public void ezcConfigurationFileWriter::setOptions()
Sets the options $configurationData.
From ezcConfigurationWriter :
public abstract string ezcConfigurationWriter::getLocation()
Returns the current location string.
public abstract string ezcConfigurationWriter::getName()
Returns the current name for the configuration to be written.
public abstract array ezcConfigurationWriter::getOptions()
Returns the current options for the writer.
protected abstract string ezcConfigurationWriter::getSuffix()
Returns the suffix used in the storage filename.
public abstract void ezcConfigurationWriter::init()
Initializes the writer with a $location and a $name.
public abstract void ezcConfigurationWriter::save()
Saves the current config object.
public abstract void ezcConfigurationWriter::setConfig()
Sets the configuration object that will be used for the next call to save().
public abstract void ezcConfigurationWriter::setOptions()
Sets the options for the writer.

Methods

getSuffix

string getSuffix( )
Returns the suffix used in the storage filename.

Redefinition of

Method Description
ezcConfigurationWriter::getSuffix() Returns the suffix used in the storage filename.

writeSettings

void writeSettings( resource $fp, array $settings, [array $comments = array()] )
Writes the settings and comments to disk
This method loops over all groups and settings and write those to disk. For the settings itself it will call writeSetting() which also detects arrays and handles those recursively.

Parameters

Name Type Description
$fp resource The filepointer of the file to write
$settings array The structure containing settings
$comments array The structure containing the comments for the settings

Last updated: Wed, 28 Nov 2007