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

Class: MediaSearch_ConfigLoader

Source Location: /MediaSearch/ConfigLoader.php

Class Overview


This class loads configs from a given directory recursivly.


Author(s):

Copyright:

  • Copyright (c) 2009 Sven Strittmatter

Constants

Methods



Class Details

[line 67]
This class loads configs from a given directory recursivly.

By default this directory is APPLICATION_PATH . DIRECTORY_SEPARATOR . 'configs'. But you can change the directory:

The config loader generates on construction time a index by walking recursiv through the directory. The whole filepath without the file extension is used as the namespaced config name.

Example: This config dir structure...

 CONFIGDIR
  +-foo/
  |   bar/
  |     +blub.php
  |     +bla.php
  +   baz/
        +blub.txt
        +bla.sql

... will be index as:

  • foo.bar.blub
  • foo.bar.bla
  • foo.baz.blub
  • foo.baz.bla
The file extension is skipped, because the config object factory determines the right implementation of MediaSearch_Config_Interface by the file extension. Beware name conflicts like file bla.txt and bla.sql in the same directory!




Tags:

copyright:  Copyright (c) 2009 Sven Strittmatter
todo:  Implement MediaSearch_Config_Xml
todo:  Implement possibility to load multible configs by 'foo.bar.*'
final:  
usedby:  CreateTablesApplication


[ Top ]


Class Methods


static method get [line 137]

static MediaSearch_Config_Abstract get( atring $name, [ $parseOptions = null])

Main entry point to get a config object according to its name, if find.

Additionaly you can pass parse options. These are objects implementing the interface MediaSearch_Config_ParseOptions_Interface. This method does lazy loading.

Implements the singleton get instance method.




Tags:

throws:  InvalidArgumentException If config file is not readable.
access:  public


Parameters:

atring   $name  
array   $parseOptions   Array of MediaSearch_Config_ParseOptions_Interface

[ Top ]

static method setConfigDir [line 153]

static void setConfigDir( string $configDir)

Sets the config directory. Also resets the instance so that the directory index will be regenerated on next get access.



Tags:

access:  public


Parameters:

string   $configDir  

[ Top ]


Class Constants

TRACE_LELVEL =  55

[line 68]


[ Top ]



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