Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcConfigurationFileReader

Configuration::ezcConfigurationFileReader

Class ezcConfigurationFileReader

ezcConfigurationFileReader class provides the functionality for reading file based configuration formats.

This class implements most of the interface of ezcConfigurationReader and makes it easier to work on file based configuration. All methods except load() and validate() are implemented by this class, so a subclass only needs to handle the actual serialization.

Source for this file: /Configuration/src/file_reader.php

ezcConfigurationReader
   |
   --ezcConfigurationFileReader
Version:   //autogen//

Descendants

Child Class Description
ezcConfigurationArrayReader This class provides functionality for reading files containing specific PHP arrays into ezcConfiguration objects.
ezcConfigurationIniReader ezcConfigurationIniReader provides functionality for reading INI files into ezcConfiguration objects.

Member Variables

protected ezcConfiguration $config = false
Contains the configuration object that was read from the file with load().
protected string $location = ''
The current location of the config, this is either the path on the filesystem or a PHP stream prefix.
protected string $name = ''
The base name of the configuration file, the suffix will be appended to this to find the real filename.
protected array $options = array()
Current options for the reader.

See the specific reader to see which options it supports.

protected string $path = ''
The path to the file which will contain the serialized configuration data.

Method Summary

public ezcConfigurationFileReader __construct( [ $path = null] )
Constructs the reader object.
public bool configExists( )
Returns true if the configuration exists.
public ezcConfiguration getConfig( )
Returns the current configuration object.
public string getLocation( )
Returns the current location string.
public string getName( )
Returns the current name for the configuration to be read.
public array getOptions( )
Returns the current options for the reader.
public int getTimestamp( )
Returns the last modified timestamp.
public void init( $location , $name , [ $options = array()] )
Initializes the reader with a location and a name. These values determine where the configuration will be serialized.
protected void parseLocationPath( $path , $suffix )
Parses a the path $path and sets the location and name properties on this object.
public void setOptions( $configurationData )
Sets the options $configurationData.

Inherited Methods

From ezcConfigurationReader
public abstract bool ezcConfigurationReader::configExists()
Checks if the configuration exists.
public abstract ezcConfiguration ezcConfigurationReader::getConfig()
Returns the current configuration object.
public abstract string ezcConfigurationReader::getLocation()
Returns the current location string.
public abstract string ezcConfigurationReader::getName()
Returns the name of the configuration to be read.
public abstract array ezcConfigurationReader::getOptions()
Returns the options for the reader.
protected abstract string ezcConfigurationReader::getSuffix()
Returns the suffix used in the storage filename.
public abstract mixed ezcConfigurationReader::getTimestamp()
Returns the last modified timestamp.
public abstract void ezcConfigurationReader::init()
Initializes the reader with a $location and a $name.
public abstract ezcConfiguration ezcConfigurationReader::load()
Loads the current config object.
public abstract void ezcConfigurationReader::setOptions()
Sets the options $options for the reader.
public abstract ezcConfigurationValidationResult ezcConfigurationReader::validate()
Validates the configuration.

Methods

__construct

ezcConfigurationFileReader __construct( [string $path = null] )

Constructs the reader object.

$path must contain the relative or absolute path to the configuration file. You can use PHP streams, e.g compress.gz://site.ini.gz.

After construction call load() to parse the INI file from disk and return a configuration object.

Parameters:
Name Type Description
$path string

configExists

bool configExists( )

Returns true if the configuration exists.

Redefinition of:
Method Description
ezcConfigurationReader::configExists() Checks if the configuration exists.

getConfig

ezcConfiguration getConfig( )

Returns the current configuration object.

Returns false if there no current configuration.

Redefinition of:
Method Description
ezcConfigurationReader::getConfig() Returns the current configuration object.

getLocation

string getLocation( )

Returns the current location string.

Redefinition of:
Method Description
ezcConfigurationReader::getLocation() Returns the current location string.

getName

string getName( )

Returns the current name for the configuration to be read.

Redefinition of:
Method Description
ezcConfigurationReader::getName() Returns the name of the configuration to be read.

getOptions

array getOptions( )

Returns the current options for the reader.

Redefinition of:
Method Description
ezcConfigurationReader::getOptions() Returns the options for the reader.

getTimestamp

int getTimestamp( )

Returns the last modified timestamp.

Returns false if there is not last current timestamp.

Redefinition of:
Method Description
ezcConfigurationReader::getTimestamp() Returns the last modified timestamp.

init

void init( string $location , string $name , [ $options = array()] )

Initializes the reader with a location and a name. These values determine where the configuration will be serialized.

Parameters:
Name Type Description
$location string The main placement for the configuration. It is up to the specific reader to interpret this value. This can for instance be used to determine the directory location for an INI file.
$name string The name for the configuration. It is up to the specific reader to interpret this value. This can for instance be the basename for the INI file, so a value of 'site' would create a file with name 'site.ini'.
$options array An associative array of options for the reader. Which options to use is determined by the specific reader class.
Redefinition of:
Method Description
ezcConfigurationReader::init() Initializes the reader with a $location and a $name.

parseLocationPath

void parseLocationPath( string $path , string $suffix )

Parses a the path $path and sets the location and name properties on this object.

ezcConfigurationFileWriter::parseLocationPath() has the same code. It is duplicated to prevent complex OO hacks.

Parameters:
Name Type Description
$path string
$suffix string
Exceptions:
Type Description
ezcConfigurationException if the configuration file has the wrong suffix.

setOptions

void setOptions( array(string=>mixed) $configurationData )

Sets the options $configurationData.

The options are specified in a associative array in the form 'optionName' => value.

Parameters:
Name Type Description
$configurationData array(string=>mixed)
Exceptions:
Type Description
ezcBaseSettingValueException if you specify a value out of range for a setting.
ezcBaseSettingNotFoundException if you try to set a non existent setting.
Redefinition of:
Method Description
ezcConfigurationReader::setOptions() Sets the options $options for the reader.
Documentation generated by phpDocumentor 1.4.3