MediaSearch_Config
[ class tree: MediaSearch_Config ] [ index: MediaSearch_Config ] [ all elements ]

Class: MediaSearch_Config_Abstract

Source Location: /MediaSearch/Config/Abstract.php

Class Overview


This is a default implementaion of a config file. It provides general purpose methods for the concrete config file objects.


Author(s):

Copyright:

  • Copyright (c) 2009 Sven Strittmatter

Implements interfaces:

Variables

Constants

Methods


Child classes:

MediaSearch_Config_Json
A concrete implemetation for JSON config files. The file can contain any JSON string. The filename extensions need to be .json.
MediaSearch_Config_Php
A concrete implemetation for PHP config files. The file need to contain a return statement of any PHP variable. The filename extensions need to be .php.
MediaSearch_Config_Sql
A concrete implemetation for SQL config files. The file can contain any SQL statement. The filename extensions need to be .sql.
MediaSearch_Config_Text
A concrete implemetation for text config files. The file can contain any text string. The filename extensions need to be .txt.

Class Details

[line 40]
This is a default implementaion of a config file. It provides general purpose methods for the concrete config file objects.



Tags:

copyright:  Copyright (c) 2009 Sven Strittmatter
abstract:  


[ Top ]


Class Variables

$parsedData =

[line 62]

Contains the parsed config data after parsing.



Tags:

access:  protected

Type:   array


[ Top ]

$rawData =

[line 55]

The original loaded string from the config file.



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


static method createConfig [line 197]

static MediaSearch_Config_Abstract createConfig( string $fileName, [ $parseOptions = null])

Factory method which creates a proper config file implementation depending on its type. The type is determined by the filename extension (@see MediaSearch_File_Util::getExtension()).



Tags:

throws:  InvalidArgumentException If unsoported file type is fiven.
access:  public


Parameters:

string   $fileName   The full file path to the config file.
array   $parseOptions   Array of optional parse option obejcts.

[ Top ]

constructor __construct [line 82]

MediaSearch_Config_Abstract __construct( string $fileName, [ $parseOptions = null])

The constructor requires the full filename to the config file.

Optional you can add an array with some parse option objects (@see MediaSearch_Config_ParseOptions_Interface).

The constructor will call load() to initiaize the config.




Tags:

access:  public


Parameters:

string   $fileName  
array   $parseOptions   Optional, default is null.

[ Top ]

method addParseOption [line 92]

void addParseOption( $option)



Tags:

see:  MediaSearch_Config_Interface
access:  public



Implementation of:
MediaSearch_Config_Interface::addParseOption()
With this method you can add some parse options. These are objects

Parameters:


[ Top ]

method addParseOptions [line 101]

void addParseOptions( $options)

Adds multiple parse options in an array.



Tags:

access:  public


Parameters:

array   $options   Array of MediaSearch_Config_ParseOptions_Interface

[ Top ]

method applayParseOptions [line 235]

void applayParseOptions( )

Apply the added parse options to the data parsed by parseData().



Tags:

access:  protected


[ Top ]

method get [line 173]

mixed get( [string $name = null])



Tags:

see:  MediaSearch_Config_Interface Returns nulll if the given $name is not found in the config.
access:  public



Implementation of:
MediaSearch_Config_Interface::get()
Returns a config value from the loaded and parsed configuration by its index. The index could be a string or integer. Thats depending on the implemention of the config file types and your parse options.

Parameters:

string   $name   Optional, returns the whole parsed data if not set.

[ Top ]

method getFileName [line 135]

void getFileName( )



Tags:

see:  MediaSearch_Config_Interface
access:  public



Implementation of:
MediaSearch_Config_Interface::getFileName()
Returns the file name of the config file.
[ Top ]

method getRawData [line 147]

void getRawData( )



Tags:

see:  MediaSearch_Config_Interface Implements lazy loading and loads the raw data on first use.
access:  public



Implementation of:
MediaSearch_Config_Interface::getRawData()
Returns the string from the loaded config file.
[ Top ]

method hasParseOptions [line 121]

void hasParseOptions( )



Tags:

see:  MediaSearch_Config_Interface
access:  public



Implementation of:
MediaSearch_Config_Interface::hasParseOptions()
Returns if the config file has parse options added.
[ Top ]

method loadRawData [line 160]

void loadRawData( )

Loads the data by file_get_contents() from file.



Tags:

access:  protected


Overridden in child classes as:

MediaSearch_Config_Php::loadRawData()

[ Top ]

method parseData [line 225]

void parseData( )

The default parse behaviour is copying the loaded file string with no modification to parsed data.

This behaviour could be modified by overwriting in the concrete implementations.

Attend that after that applayParseOptions() is called.




Tags:

access:  public


Overridden in child classes as:

MediaSearch_Config_Json::parseData()
Parses the data by json_decode() to an array.


Implementation of:
MediaSearch_Config_Interface::parseData()
Parses the config string. Depending on the config type.
[ Top ]

method removeParseOptions [line 114]

void removeParseOptions( )



Tags:

see:  MediaSearch_Config_Interface
access:  public



Implementation of:
MediaSearch_Config_Interface::removeParseOptions()
Removes all parse options.
[ Top ]

method setFileName [line 128]

void setFileName( $fileName)



Tags:

see:  MediaSearch_Config_Interface
access:  public



Implementation of:
MediaSearch_Config_Interface::setFileName()
Expects the full filepath to the config file you want to load.

Parameters:

   $fileName  

[ Top ]


Class Constants

TRACE_LELVEL =   9

[line 41]


[ Top ]



Documentation generated on Mon, 17 Aug 2009 14:51:08 +0200 by phpDocumentor 1.4.2