Source for file Setting.class.php
Documentation is available at Setting.class.php
* Gumbo Library Framework
* This library is being released under the terms of the New BSD License. A
* copy of the license is packaged with the software (LICENSE.txt). If no
* copy is found, a copy of the license template can be found at:
* http://www.opensource.org/licenses/bsd-license.php
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
* This is a special Setting Interface for the Load Interface. A Load Setting
* holds rules on how to Load a particular file into memory. A series of
* Settings can be created for a variety of file types. Each Load Setting
* element refers to a parameter in one of the Load methods. By defining a
* Load Setting, the programmer would not have to memorize the entire list
* arguments required by certain Gumbo_Interface_Load methods, just a key
* $load->load ("File_Name", "my_key");
* This provides a list of directories to search for the possible existence
* of the file. The list will be searched in the order they are added. The
* list will be appended to the type of path chosen (see below). This is where
* the use of a custom directory is important. Place the custom directory ahead
* This simply indicates that the file name passed is the class name. There are
* special rules when loading a Class file and a regular file. There can only be
* one definition of a Class or Interface.
* This will define the file extension of the file being passed. The file name
* passed does not need to include the file extension. If the extension argument
* is set, then it will replace the extension in the file name (file_name.*.ext).
* It will only replace the last part of the extension. So, if passing
* "file_name.class.php" with an extension "inc.php", the search will be for
* "file_name.class.inc.php". If the extension is not set, the default value
* This will load the file only once. This is useful for files that hold a series
* of functions or multiple class definitions.
* This setting will tell the Loader to use the include[_once] functions instead of
* the require[_once] functions. The default is require.
* This setting will expand the file name into additional directory paths. For example,
* the Gumbo Library is organized using the stretch feature. To find the Gumbo_Valid_Address
* class, simply go into <gumbo_home[custom]_path>/valid/Address.class.php. The last element
* of the file name should be the actual file name. The stretch feature will use the
* separator string (see below) for searching.
* This is a character of string of characters to use to separate the file name into
* directory paths. The default is an underscore "_" (see example above).
* This indicates the starting path of the search. The directories list will be
* appended to this location, followed by any stretch definitions, then the file
* name and extension. The path is separated into three areas.
* - include (default), uses the include path
* - home, indicates the path to the Gumbo Library
* - absolute, indicates the directories are from the home path
* This is a character or string of characters to remove from the file name prior to
* searching. For example, when searching for Library files, I would want the
* library path (home or custom) to be the starting point, followed by the stretch
* of the file name "Gumbo_Valid_Address". Without remove, the path would be created
* as '<home>/gumbo/valid/address.class.php'. With remove set to "Gumbo_" (default),
* the string will be removed prior to setting the file path. Now, the path will be
* '<home>/valid/address.class.php'. This feature can be used to create a Load Setting
* for the Zend Framework, using remove as 'Zend_'.
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
* @desc Load Setting Interface
* Adds a single directory path to the list
public function addDir ($dir);
* Sets the setting to load a class file
* Adds a list of directories to the list
* There are three ways to set the Directory paths. The first method passes
* a string, with either a single directory or list of directories separated
* by the PATH_SEPARATOR constant. The second passes an array, with each
* element value a different directory. The third involves either of the first
* two methods, but multiple arguments.
* 1. $this->setDirs ("path1:path2:path3/path4");
* 2. $this->setDirs (array ("path1", "path2", "path3/path4"));
* 3. $this->setDirs ("path1", array ("path2"), "path3/path4:path5");
* @param array|string$dirs ...[]
* Sets the file extension (leading "." not necessary)
* Sets the load only once setting
* Sets to use include instead of require
* Sets to stretch the file name as additional directory paths
* Sets the stretch separator character
* Sets the path to start searching from.
* - include: search the include path (default)
* - home: start from Gumbo home directory
* - absolute: ignores starting point and uses dirs as absolute paths
* Sets a string pattern to remove from the file name before search
* Returns if the setting is for a class load
* Returns the list of directory paths
* Returns the file extension
* Returns if the file should be loaded once
* Returns if the include function should be used instead of require
* Returns if the file name should stretch
* Returns the stretch separator character
* Returns the path to start searching from
* Returns the remove string pattern