Class: ConfigurationReader

Source Location: /CORE/system/classes/configuration/ConfigurationReader.php

Class ConfigurationReader

Class Overview

This class provides methods for reading Database driven Configurations.

It is designed to be used as static class, to avoid instantiation.
Use it as follows:

  1.  $bar ConfigurationReader::getConfigurationEntry('foo''bar');

Located in /CORE/system/classes/configuration/ConfigurationReader.php [line 44]



		
				Author(s):
		
  • Kevin Papst
Information Tags:
Version:  $Id: ConfigurationReader.php,v 1.11 2008/06/08 12:58:07 kpapst Exp $
Copyright:  Copyright (C) Kevin Papst
License:  GNU Public License

Methods

[ Top ]
Method Summary
static void   cacheEntry()   Sets or returns a Cache Entry.
static void   cachePackage()   Sets or returns a Cache Entry.
static array   getAll()   Gets all Configuration Values available.
static void   getArrayFromResult()   Create an Bunch of Entrys from a Database Result.
static ConfigurationEntry   getConfigurationEntry()   Fetch a known ConfigurationEntry from a Configuration Package.
static void   getConfigurationValue()  
static void   getEntryFromResult()   Create a Entry from a Database Result.
static array   getPackage()   All Value of the Package will be fetched and returned as an Array of
instances.
static mixed   getValue()   Returns the Value of a ConfigurationEntry, or
  1. $undefined
if the requested Configuration Entry could not be found.

[ Top ]
Methods
static method cacheEntry  [line 161]

  static void cacheEntry( $package, $name, [ $entry = NULL]  )

Sets or returns a Cache Entry.

Parameters:
   $package: 
   $name: 
   $entry: 

API Tags:
Access:  public


[ Top ]
static method cachePackage  [line 187]

  static void cachePackage( $package, [ $entrys = NULL]  )

Sets or returns a Cache Entry.

Parameters:
   $package: 
   $entrys: 

API Tags:
Access:  public


[ Top ]
static method getAll  [line 52]

  static array getAll( )

Gets all Configuration Values available.

Calls will never be cached.


API Tags:
Return:  all Configurations as ConfigurationEntry objects in an Array
Access:  public


[ Top ]
static method getArrayFromResult  [line 219]

  static void getArrayFromResult( $result, [ $assoc = false]  )

Create an Bunch of Entrys from a Database Result.

Parameters:
   $result: 
   $assoc: 

API Tags:
Access:  public


[ Top ]
static method getConfigurationEntry  [line 104]

  static ConfigurationEntry getConfigurationEntry( String $package, String $name  )

Fetch a known ConfigurationEntry from a Configuration Package.

Parameters:
String   $package:  the Package Name to fetch
String   $name:  Name of the Configuration Name to fetch

API Tags:
Return:  the ConfigurationEntry Object or null
Access:  public


[ Top ]
static method getConfigurationValue  [line 123]

  static void getConfigurationValue( $package, $name, [ $undefined = null]  )

Parameters:
   $package: 
   $name: 
   $undefined: 

API Tags:
Deprecated:  see ConfigurationReader::getValue($package, $name, $undefined)
Access:  public


[ Top ]
static method getEntryFromResult  [line 206]

  static void getEntryFromResult( $result  )

Create a Entry from a Database Result.

Parameters:
   $result: 

API Tags:
Access:  public


[ Top ]
static method getPackage  [line 78]

  static array getPackage( String $package  )

All Value of the Package will be fetched and returned as an Array of

instances.

This method call caches its Results (if not NULL).
If a Package was read, Calls against the same package within the methods

and
will fetch their results from this cached Package.
If you want to read more than ONE entry/value of a Package it is always recommended to call
  1. getPackage($package)
first to fill the cache and speed up the Calls (less DB calls).

Parameters:
String   $package:  the Package Name to fetch

API Tags:
Return:  an Array of ConfigurationEntry Objects with keys of Config Names
Access:  public


[ Top ]
static method getValue  [line 140]

  static mixed getValue( String $package, String $name, [mixed $undefined = null]  )

Returns the Value of a ConfigurationEntry, or

  1. $undefined
if the requested Configuration Entry could not be found.

No need of explicit casting for:

  • CONFIG_TYPE_BOOLEAN

Parameters:
String   $package:  package the Parameter Package
String   $name:  name the Parameter Name
mixed   $undefined:  undefined fallback value for not found Configuration Entry

API Tags:
Return:  the Value or NULL
Access:  public


[ Top ]