Implements interfaces:
Class Package
Class provides methods to import packages of classes without the need to use __autoload(). This is achieved via its public method import($path) which allows a Java-Like type of import.
It allows to use the wild card character * to import all php classes in a directory.
Example of usage in home directory:
include_once("classes/Package.class.php");
$package = new Package();
$package->import('classes.*');
$package->import('classes.sql.*');
Or can be used to import single classes
$package->import('classes.sql.AClass.php')
Located in /Package.class.php (line 24)
Constuctor for Package objects
Initialises private members imports and classesIds
import(String) method
Feeds the imports array for this class.
Array of imports is to be processed in loadClasses($path) method
$import must be of type dir.subdir.className (without extension .class.php)
wild card * can be used to import all classes in a directory, provided they were
always named using the extention ".class.php"
If you have a different class naming convention set up for your classes you simply need to edit this method and the loadClasses($path) method
loadClasses($path)
To be called after all calls to import() have been made
$path should be in the form (../ or ../../ etc) and represents the location where all classes for your projects are located
For example if you have files calling this method in public_html, and classes to load in public_html/classes there is no need to change the default value for $path argument.
If you are loading classes from a directory above the location of the file calling this method $path should be set to ../ or ../../ and so on.
The best way to define $path is to do it via a constant variable in the Packagable interface file, before the definition of the interface itself is made. This to avoid having the / characters as a argument to this function.
Documentation generated on Sat, 23 Feb 2008 21:29:14 +0000 by phpDocumentor 1.3.0RC3