Apache Zeta Components - high quality PHP components

Apache Zeta Components Manual :: Docs For Class ezcConfigurationIniWriter

Configuration::ezcConfigurationIniWriter

Class ezcConfigurationIniWriter

This class provides functionality for writing ezcConfiguration objects into INI files.

A typical usage is to create the writer object and pass the filepath in the constructor:

  1.  // $conf is an ezcConfiguration object
  2.  $writer = new ezcConfigurationIniWriter( "settings/site.ini", $conf );
  3.  $writer->save();
That makes the class figure out the location and name values automatically.

Or generally use the init() function:

  1.  // $conf is an ezcConfiguration object
  2.  $writer = new ezcConfigurationIniWriter();
  3.  $writer->init( "settings", "site", $conf );
  4.  $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.

Source for this file: /Configuration/src/ini/ini_writer.php

ezcConfigurationWriter
   |
   --ezcConfigurationFileWriter
      |
      --ezcConfigurationIniWriter
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 string getSuffix( )
Returns 'ini'. The suffix used in the storage filename.
protected 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 'ini'. 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 , $settings , [ $comments = array()] )

Writes the settings and comments to disk

This method loops over all groups and settings (defined with the $settings array) and writes those to disk. For the settings itself it will call writeSetting() which also detects arrays and handles those recursively. See ezcConfiguration::$settings and ezcConfiguration::$comments for the formats of those arrays.

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.
Documentation generated by phpDocumentor 1.4.3