Apache Zeta Components - high quality PHP components

Apache Zeta Components Manual :: Docs For Class ezcConfigurationIniParser

Configuration::ezcConfigurationIniParser

Class ezcConfigurationIniParser

This class provides functionality for parsing INI files

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

Implements interfaces:

  • Iterator (internal interface)
Version:   //autogen//

Constants

DIM_REGEXP = '((\[[^\]]*\])*)' A regexp that matches the rules that are defined for an dimension extension
ID_REGEXP = '([A-Za-z0-9_.-]+)' A regexp that matches the rules that are defined for an ID
PARSE = 1 A constant to mark this parser as a reader
VALIDATE = 2 A constant to mark this parser as a validator
VALIDATE_STRICT = 3 A constant to mark this parser as a strict validator

Method Summary

public ezcConfigurationIniParser __construct( $type , $path )
Constructs the parser object
public ezcConfigurationIniItem current( )
Returns the last parsed item
public int key( )
Returns the "key" for each element.
public void next( )
Advances until the next parser element has been found
public void rewind( )
Throws an Exception saying that this should not be used.
public bool valid( )
Returns whether there are more valid elements in the file.

Methods

__construct

ezcConfigurationIniParser __construct( int $type , string $path )

Constructs the parser object

Constructs the parser and initializes it with the file to read. After construction use it as an iterator with foreach () to iterate over the settings in the file.

Parameters:
Name Type Description
$type int What type of parser it is (PARSE, VALIDATE, VALIDATE_STRICT)
$path string The relative or absolute path to where the configuration should be read from. Using PHP streams is also possible, e.g. compress.gz://site.ini.gz

current

Returns the last parsed item

Returns the last parsed item, as parsed by the next() method. Depending on the type of parser (selectable in the constructor) it returns either an configuration item or an configuration warning item.

Implementation of:
Method Description
Iterator::current

key

int key( )

Returns the "key" for each element.

This is used by the Iterator to assign a key to each "array" element. As we don't use that we simply return 0.

Implementation of:
Method Description
Iterator::key

next

void next( )

Advances until the next parser element has been found

This is used by the Iterator to advance to the next element. It calls the parseNext() method which returns when a Group Header, Setting or Validation error has been found.

Implementation of:
Method Description
Iterator::next

rewind

void rewind( )

Throws an Exception saying that this should not be used.

This is used by the Iterator to rewind to the start of the array. As this implementation of the Iterator interface does not allow this, and can only be used together with the NoRewindIterator mechanism it simply throws an Exception.

Exceptions:
Type Description
Exception whenever this method is called.
Implementation of:
Method Description
Iterator::rewind

valid

bool valid( )

Returns whether there are more valid elements in the file.

This is used by the Iterator to check whether the end of the array has been reached. We simply check for the end-of-file marker as "valid condition".

Implementation of:
Method Description
Iterator::valid
Documentation generated by phpDocumentor 1.4.3