## Apache Zeta Components Manual :: Docs For Class ezcConfigurationArrayWriter

### Configuration::ezcConfigurationArrayWriter

### Class ezcConfigurationArrayWriter

This class provides functionality for writing ezcConfiguration object into files containing PHP arrays.

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.

Source for this file: /Configuration/src/array/array_writer.php

    ezcConfigurationWriter
       |
       --ezcConfigurationFileWriter
          |
          --ezcConfigurationArrayWriter

Version: | //autogen//

### 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 static void | `writeSettings( $fp , $settings , [ $comments = array()] )` Writes the settings and comments to disk
protected string | `getSuffix( )` Returns the suffix used in the storage filename.

### 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

#### writeSettings

static 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

#### 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.

Documentation generated by phpDocumentor 1.4.3