Class AdminPageFramework_RegisterClasses
Registers classes in the given directory to be auto-loaded.
Usage
Pass the scanning directory path or a list of class files to the class constructor and it will register the classes to be auto-loaded. To set a class file path array, the structure must be consist of elements of a key-value pair of a file path and the key of the class name.new RegisterClasses( array( $sMyDirPath, $sAnotherDirPath ), $aOptions=array(), $aFlassFilePaths=array() );
Example
$aClassFiles = array( "AdminPageFramework" => $sDirPath . "/factory/admin_page/AdminPageFramework.php", "AdminPageFramework_Controller" => $sDirPath . "/factory/admin_page/AdminPageFramework_Controller.php", "AdminPageFramework_Controller_Form" => $sDirPath . "/factory/admin_page/AdminPageFramework_Controller_Form.php", "AdminPageFramework_Controller_Menu" => $sDirPath . "/factory/admin_page/AdminPageFramework_Controller_Menu.php", "AdminPageFramework_Controller_Page" => $sDirPath . "/factory/admin_page/AdminPageFramework_Controller_Page.php", ); new AdminPageFramework_RegisterClasses( '', // the scanning directory - do not scan anything array( 'exclude_class_names' => array( 'AdminPageFramework_MinifiedVersionHeader', 'AdminPageFramework_BeautifiedVersionHeader', ), ), $aClassFiles // a class list array ); // Then the registered classes can be instantiated without including them as they are all handled by the auto-loader. $_oAdminPage = new AdminPageFramework( ... );
See the __construct()
method below for the details of
arguments.
Package: AdminPageFramework\Common\Utility
Version: 1.0.0
Since: 3.0.0
Located at factory/_common/utility/AdminPageFramework_RegisterClasses.php
Version: 1.0.0
Since: 3.0.0
Located at factory/_common/utility/AdminPageFramework_RegisterClasses.php
Methods summary
public
|
#
__construct( array|string $asScanDirPaths, array $aOptions = array(), array $aClasses = array() )
Sets up properties and performs registering classes. Parameters
Remark
The directory paths set for the 'exclude_dir_paths' option should use the system
directory separator.
|
Magic methods summary
Properties summary
public
array
|
$_aClasses |
#
Stores the registered classes with the key of the class name and the value of the file path. |
protected static
array
|
$_aStructure_Options |
#
Represents the structure of the recursive option array. |