autoload.php

Class autoloading package

Version: $Date: 2012/03/07 21:30:28 $

PHP version: 5

Required modules: standard

Required packages: AutoloadException.php

Author: Umberto Salsi <salsi@icosaedro.it>

This package provides the magic __autoload() function for class autoloading, and also makes aware PHPLint that class autoloading is enabled and how to fetch the required classes. The PHPLint reference manual explains in more details how the class autoloading mechanism works and when class autoloading is triggered by PHPLint and by PHP.

This file should be located in the base directory of the libraries tree. In turn, every library should then import this package using something like:

require_once __DIR__ . "/../../../autoload.php";
Note that we must use the special constant __DIR__ because at runtime the current working directory is set by the client package (that is, the original PHP program that was started first) and might not be the directory of the library itself.

Another feature of this package is that it verify that the correct PHP configuration file be loaded. The php.ini file MUST be located in the same directory of this package. If not found there, the program exits with die().



SRC_BASE_DIR = "/home/salsi/src/phplint/stdlib"

Base directory of all the libraries, that is the directory of this package

Actually, the value is set dynamically at runtime, so there is no need to set this for every specific environment. Client packages may then use this constant to load other packages from the library that provide only constants and functions or classes that does not require the autoload mechanism:

	require_once __DIR__ . "/../../../autoload.php";
	require_once SRC_BASE_DIR . "/errors.php";
	require_once SRC_BASE_DIR . "/it/icosaedro/bignumbers/BigFloat.php";
	require_once SRC_BASE_DIR . "/com/acme/web/SessionHandlingFuncs.php";
	require_once SRC_BASE_DIR . "/com/acme/db/OurDBConnectionParams.php";
	


void __autoload(
        string $className)

Performs class autoloading

Uses 'schema1' and search for the class in the same directory where this package resides, adding ".php" at the end of the string. This function is intended to be called automatically by the PHP interpreter, and should never be called explicitly from user code.

Parameters:
$className   Fully qualified class name.

Throws:

Private items

check_php_ini()

Generated by PHPLint Documentator