Class Ismo_Core_Loaders_IncludePath

Description

This loader loads files from PHP's include path.

Files are added to this loader, and after that they can be "loaded" using their added short name.

The getInstance() method only looks through the added files when a class instance is requested.

Located in /Loaders/IncludePath.php (line 40)


	
			
Variable Summary
array $_files
Method Summary
Ismo_Core_Loaders_IncludePath Ismo_Core_Loaders_IncludePath ()
void addFile (string $name, string $className, string $fileName)
string findFile (string $fileName)
mixed &getInstance (string $className)
mixed &openFile (string $fileName)
Variables
array $_files = array() (line 49)

The configured files.

  • access: private
Methods
Constructor Ismo_Core_Loaders_IncludePath (line 58)

The constructor.

  • access: public
Ismo_Core_Loaders_IncludePath Ismo_Core_Loaders_IncludePath ()
addFile (line 115)

Adds one file.

All files this loader should be able to load need to be added with this method. Otherwise getInstance() can't map from the file name to the class name and the file the class is defined in.

Example:

  1. $loader = new Ismo_Core_Loaders_IncludePath();
  2. $loader->addFile('main', 'Ismo_Example_States_Main',
  3. 'Ismo/Example/States/Main.php');

  • access: public
void addFile (string $name, string $className, string $fileName)
  • string $name: the name of the file use in
    1. getInstance()
  • string $className: the name of the class in the file
  • string $fileName: the name of the file the class is definied in
findFile (line 134)

Returns the full path to a file found from PHP's include path.

This method needs to be implemented

  • return: the full path to the file or
    1. null
    if it wasn't found
  • access: public
string findFile (string $fileName)
  • string $fileName: the name of the file to try to find
getInstance (line 76)

Loads, creates and returns an instance of the requested class.

Looks through the added files (see

  1. addFile
) and if a match is found that file is
  1. included
and an instance created and returned.

  • return: the class instance or
    1. null
    if it couldn't be created
  • access: public
mixed &getInstance (string $className)
  • string $className: the name of the class
openFile (line 156)

Tries to open a file if it's found from PHP's include path.

Note It's the callers responsibility to close the returned file handle.

This method needs to be implemented

  • return: a file handle to the file if it was found or
    1. null
    if it wasn't found
  • access: public
mixed &openFile (string $fileName)
  • string $fileName: the name of the file to try to open

Documentation generated on Mon, 14 Jun 2004 11:59:25 +0200 by phpDocumentor 1.3.0RC3